opencode
Written for opencode 1.18.34 (npm opencode-ai@latest, the V1 provider schema). opencode talks to zdr.sh over Chat Completions through its bundled @ai-sdk/openai-compatible provider.
Configure#
Put this in opencode.json, global at ~/.config/opencode/opencode.json or in the project. The key is read from the environment with {env:ZDR_API_KEY}.
json
Then run opencode and pick a zdr/ model with /model, or start with opencode -m zdr/glm-5.3.
The parts that matter#
limitis required. opencode fails a model entry with a partiallimitand treats an omitted one as 0/0, which disables compaction and long sessions. Bothcontextandoutputare needed.- One id per model. The config key and the
idare the model id, with no suffix. interleaved. opencode strips reasoning from assistant history and sends it back inreasoning_contentonly when this is set. Set it on every model.- No model discovery. opencode never calls
GET /v1/modelsfor a custom provider, so the list above is the list you get.opencode models zdrprints it. - Effort variants. Define one by hand when you want a selector:
json
Auth without the environment#
Run opencode auth login, choose Other, enter the provider id zdr and paste the key; then remove options.apiKey. In the TUI the same flow is /connect. The stored key is used only when the config does not set one.