Skip to content

About

A floating desktop pet for OpenCode with custom ChatGPT sprites and your own AI models

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OpenCode Pet

English · Español

A floating desktop companion for OpenCode on Linux. It shows when your agent is working or needs input, lets you start chats from the pet, uses your own OpenCode provider and model, and displays your own ChatGPT/Codex pet sprite sheet. Your images stay on your computer.

Easy install on Ubuntu/Debian

Install OpenCode first. Download opencode-pet_0.2.3_all.deb from Releases, then run this in the directory containing the downloaded file:

sudo apt install ./opencode-pet_0.2.3_all.deb
opencode-pet

You can also open OpenCode Pet from your applications menu. apt installs Python, GTK and PyGObject if needed. On launch, the app installs or upgrades the OpenCode plugin for your user account; it never asks for model API keys or moves your pet images. Quit and restart OpenCode after first launch or an app upgrade so it loads the plugin. Right-click the pet to close it. Close any copy launched from source before starting the packaged app.

From source (or on a different Linux distribution with GTK 3 and PyGObject available):

git clone https://github.com/binaryTob/opencode-pet.git
cd opencode-pet
python3 pet.py --install
python3 pet.py

For developers, packaging/build-deb.sh builds the package into dist/. We chose .deb first because Ubuntu/Debian resolve the native GTK dependencies. An AppImage would require bundling and testing those libraries across multiple distributions.

Use your own model

Configure your provider in OpenCode with /connect (provider guide). The pet never asks for or stores API keys. In ✎ Chats, choose a project and open the selector under Modelo. Filter by connected provider and use Buscar modelo, proveedor o ID… to search by name or ID. OpenCode Go (opencode-go) and OpenCode Zen (opencode) appear when available to that OpenCode instance. The list initially renders up to 60 results for speed, but the search covers every model in its catalog. Predeterminado de OpenCode uses OpenCode's configured model; click ↻ after connecting a new provider to refresh the catalog. Choose a conversation or click + Nueva to start one. If the picker says «Plugin antiguo», restart that OpenCode instance; the pet will detect its updated catalog. The current UI labels are in Spanish.

Import your ChatGPT pet

Download your transparent PNG/WebP pet image from ChatGPT/Codex. Supported formats: 1536×1872 (8×9) or 1536×2288 (8×11) Codex sprite grids (including cleanly scaled versions), eight frames in one horizontal strip separated by transparent gaps (even when the width isn't divisible by eight), or a single image for a still pet. For one-row strips and single images, the pet adapts the art locally to the renderer; it reuses the available frames across work states. Codex pet folders containing pet.json and spritesheet.png/.webp also work.

  • In the window: Mascota → Importar PNG/WebP… selects the image and switches immediately.
  • In a terminal: opencode-pet --import-pet "/path/to/spritesheet.png"; restart the window to see it.
  • opencode-pet --list-pets lists saved pets; opencode-pet --pet imported-name picks one at startup.

Load every animation generated by GPT

If ChatGPT gave you one image per task, put them together in a folder outside this repository and create states.json there. One import can load all nine state animations and, optionally, four cursor-following animations. Declare each image and its frame count: idle, waving, jumping, waiting and working do not use the same number of frames. The filenames below are generic examples; replace them with yours.

{
  "id": "my-pet",
  "displayName": "My pet",
  "animations": {
    "idle":          { "file": "idle.png", "frames": 6 },
    "running-right": { "file": "right.png", "frames": 8 },
    "running-left":  { "file": "left.png", "frames": 8 },
    "waving":        { "file": "wave.png", "frames": 4 },
    "jumping":       { "file": "jump.png", "frames": 5 },
    "failed":        { "file": "error.png", "frames": 8 },
    "waiting":       { "file": "waiting.png", "frames": 6 },
    "running":       { "file": "working.png", "frames": 6 },
    "review":        { "file": "review.png", "frames": 6 }
  },
  "look": {
    "around": { "file": "look-around.png", "frames": 4 },
    "up":     { "file": "look-up.png", "frames": 8 },
    "right":  { "file": "look-right.png", "frames": 8 },
    "left":   { "file": "look-left.png", "frames": 8 }
  }
}

Run opencode-pet --import-pet "/path/to/folder" or use Mascota → Importar carpeta animada…. The importer divides each strip by its own frame count, composes an atlas and saves the result only in your data directory. Source images stay in their original folder. The Codex format holds at most eight frames per row, so the importer checks the official counts. The look section is optional: its animations are saved separately and let the idle pet follow your cursor without replacing working, waiting or error states. Each look strip can have one to eight frames. If GPT also generated a single base/reference image, keep it in the folder; it does not need an entry because the pet displays the animations.

Privacy: states.json, original images, compiled atlases, your selected pet and provider credentials remain on your machine. The repository contains only code and a generic format example. Do not add your personal assets to Git.

Imported pets live only on your machine at ${XDG_DATA_HOME:-~/.local/share}/opencode-pet/pets/. Your selection is saved at ${XDG_CONFIG_HOME:-~/.config}/opencode-pet/settings.json. Without an image, the window uses its own included placeholder. Third-party artwork is not bundled; import only art you are permitted to use.

Animation states

For a Codex 8×9 atlas, the renderer follows OpenAI's hatch-pet row definitions and frame timings. An eight-frame horizontal strip is only one animation: it repeats for every status, while the status label still changes.

OpenCode status Atlas row Pet behavior
Idle 0 · idle Calm loop, 6 frames
Working 7 · running Focused work, 6 frames (not walking)
Needs input 6 · waiting Waiting for approval or an answer, 6 frames
Ready 3 · waving Brief completion signal, 4 frames
Error 5 · failed Error reaction, 8 frames

Row 1 (8 frames) plays when the window moves right and row 2 (8) when it moves left. Row 4 (5) briefly celebrates a completed task before the wave. Row 8 (6) plays when OpenCode emits a review or code-review command. Our Ready signal currently expires after 12 seconds rather than tracking unread messages.

Usage and troubleshooting

✎ Chats lists recent sessions in projects with OpenCode running. Messages and activity refresh every few seconds. Drag the pet with the left mouse button. On GNOME/Wayland it uses XWayland, when available, to request always-on-top and keep both the pet and chat panel visible when switching virtual desktops; on pure Wayland the compositor decides.

  • No projects / connection error: run opencode-pet --install, quit all running OpenCode instances, then start OpenCode again. Check the pet with curl http://127.0.0.1:47829/health.
  • No models listed: connect a provider inside OpenCode using /connect, then reopen the panel.
  • Image isn't animating: use a PNG/WebP under 20 MiB with eight frames separated by transparent gaps. Without recognizable frame gaps, the image is displayed as a still pet.
  • Port 47829 in use: another pet window is already running; close it before starting a second one.

opencode-pet --install is idempotent and backs up a previous version of this plugin as pet.js.backup before updating it. To uninstall the package, close the window and run sudo apt remove opencode-pet. The per-user plugin remains at ~/.config/opencode/plugins/pet.js; remove it if no longer wanted and restart OpenCode. Your personal pet files remain in the data directory until you choose to remove them.

Development

python3 -m unittest -v test_pet.py
python3 -m unittest -v test_gui.py  # with a graphical session; CI uses Xvfb
bun test plugin.test.ts

plugin/pet.js exposes only four chat operations plus a model list through a loopback HTTP bridge on a random port. The window listens for activity on 127.0.0.1:47829. OpenCode's own client manages provider authentication; you do not need to run opencode serve.

Code is MIT licensed. See CONTRIBUTING.md to contribute. Independent project, not affiliated with OpenAI or the OpenCode maintainers.

About

A floating desktop pet for OpenCode with custom ChatGPT sprites and your own AI models

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages