Adds PPQ to OpenCode as a model provider. The plugin creates
the provider, integrates with /connect, and imports model capabilities and
pricing from PPQ's live catalog.
This avoids maintaining a static model list as PPQ adds or changes models. The plugin is already installed in the OpenCode GSD Devcontainer.
- OpenCode 2.1.1 or newer with support for local TypeScript plugins.
- A funded PPQ account and API key to run models. You can create one through PPQ.
Listing the catalog is public, but the plugin waits for a credential before showing the full catalog so unavailable models do not fill the model picker.
If upgrading a manual install, remove the old opencode-ppq.ts file from the
project’s .opencode/plugins/ or your OpenCode config directory’s plugins/
folder so OpenCode doesn’t load both copies.
Install globally from GitHub with OpenCode 2.1.1 or newer and Git:
opencode plugin add 'github:ibobik/opencode-gsd-devcontainer#master::path:opencode-ppq-plugin'Use a release tag or full commit hash instead of master to pin an installation.
To update an existing branch-based installation:
opencode plugin update 'github:ibobik/opencode-gsd-devcontainer#master::path:opencode-ppq-plugin'- Start OpenCode.
- Run
/connect. - Select PPQ.
- Open PPQ, add funds, and create an API key.
- Paste the key into OpenCode.
- The catalog reloads after connecting or switching credentials.
You can also set PPQ_API_KEY before starting OpenCode:
PPQ_API_KEY=your-key opencodeCredentials are resolved in this order:
PPQ_API_KEYexported in the process environment.- The active PPQ connection stored by OpenCode 2, resolved through its integration API.
providers.ppq.settings.apiKeyin OpenCode configuration.
Prefer environment or stored credentials over placing a key in configuration.
After finding a credential, the plugin requests https://api.ppq.ai/v1/models
without sending the credential. It maps the returned context limits,
modalities, tool/temperature support, and token prices into OpenCode's v2 model
definitions. Reasoning controls are handled by the selected provider/model protocol.
The catalog is cached for ten minutes at
$XDG_DATA_HOME/opencode/ppq-models.cache.json, or
~/.local/share/opencode/ppq-models.cache.json when XDG_DATA_HOME is unset.
If a refresh fails, the plugin uses an older valid cache when available. Without
a credential, or when no catalog or cache can be loaded, PPQ shows one
sign-in-required model with instructions instead of an unusable model list.
Static models declared in providers.ppq.models are preserved and take
precedence over catalog entries with the same ID.
OpenCode 2's OpenAI-compatible runtime requests streaming usage automatically.
When PPQ returns usage, OpenCode records input, output, reasoning, and cache-token
counts in the assistant message and session totals. The plugin supplies prices
from PPQ's catalog so OpenCode can calculate estimated costs. No separate usage
hook or compatibility.streamUsage setting is needed.
Reported counts depend on what PPQ and the upstream model return. If usage is absent, the plugin does not estimate or fabricate token counts. Cache prices are currently set to zero because the catalog mapping does not supply cache rates; estimated cost is not an authoritative PPQ invoice or account balance.
Use OpenCode's usage display, or /tokens_session when OpenCode Quota is installed,
to inspect the recorded usage. PPQ account-balance and quota reporting are not
provided by this plugin.
- Only
sign-in-requiredappears: connect PPQ and check catalog connectivity. If needed, stop the background service and restart OpenCode. - A key set only in a project
.envfile is ignored: OpenCode does not read.envfiles. ExportPPQ_API_KEYin the shell or store the key with/connect. - The catalog does not refresh: wait ten minutes, remove the cache, or restart
after checking network access to
api.ppq.ai. - A configured key is ignored:
PPQ_API_KEYand OpenCode's stored credential take precedence. - A newly exported key has no effect: stop the background service before restarting so it receives the new environment.
- Inference fails after models load: verify that the key is valid and the PPQ account has funds.