Esta página está em inglês.

opencode

@ailelabs/opencode-plugin is a zero-config Aile provider for the opencode CLI. It adds every model your caller key can reach to opencode's picker, with no hand-written provider block and no per-model config.

Install

npx aile.sh setup opencode does all of this: it registers the plugin and stores your key. See Coding tools. By hand:

Terminalbash
1npm install @ailelabs/opencode-plugin

Register it in opencode.json, either in the project or at ~/.config/opencode/opencode.json:

JSONjson
1{
2 "$schema": "https://opencode.ai/config.json",
3 "plugin": [
4 ["@ailelabs/opencode-plugin", { "baseURL": "https://api.aile.sh/v1" }]
5 ]
6}

baseURL uses the relay origin

Use the public relay's /v1, https://api.aile.sh/v1. The web app's /relay proxy exists for the browser and keeps a session cookie first-party. If you omit baseURL here, set it during opencode auth login instead.

Authenticate

Terminalbash
1opencode auth login
2# choose "Aile", paste your sk-aile-… caller key

The key is stored in opencode's auth.json. After that:

Terminalbash
1opencode
2opencode -m opencode-aile/cc/claude-sonnet-5 "explain this repo"

How model ids look

Model ids are exactly what Aile advertises in GET /v1/models: <providerId>/<model>. opencode prefixes them with its own provider id in the picker:

Texttext
1opencode-aile/cc/claude-sonnet-5
2└──────┬─────┘└───────┬────────┘
3 opencode-internal what Aile receives

Only the leading opencode-aile segment is opencode's; Aile receives the bare cc/claude-sonnet-5. See Model names.

What the plugin does

Dynamic discovery. Models come from the relay's GET /v1/models, cached in-memory with a five-minute TTL and a last-known-good disk snapshot so an offline start still has a picker.

Both surfaces. Models from providers that speak Anthropic's format (cc/, anthropic/, zai/ and a few more) route through @ai-sdk/anthropic against /v1/messages; everything else goes through @ai-sdk/openai-compatible against /v1/chat/completions. Aile serves both under /v1, so this is a client-side choice rather than a constraint.

The key stays scoped. The bearer is attached only to Aile's own inference paths on the configured origin: /v1/chat/completions, /v1/messages and /v1/models. It is never sent anywhere else.

No runtime dependencies. Node built-ins only.

Availability follows the marketplace

The picker reflects what sharers can serve right now. A model that disappears between sessions means no sharer is serving it that minute. See Model names.

Troubleshooting

The picker is empty. Check baseURL ends in /v1 and that the key is a caller key (sk-aile-…). A CLI account token will not authenticate here. curl https://api.aile.sh/v1/models needs no key at all and will tell you whether the catalogue is reachable.

A model 503s. No sharer could serve that provider at the moment. Pick another, or see Errors.

Requests are slower than expected. Sharer selection is price-first; the cheapest sharer is tried before faster ones. Pin with a header if you need otherwise. See Choosing a sharer.