Fix: small model dispatch fails for custom OpenAI-compatible providers (#2134) (#2135)

* fix: add support for custom provider base URLs from config

* feat: read custom provider apiKey from config and use it as primary credential when it exists

* doc: update small-model documentation
This commit is contained in:
Andrey Meshkov
2026-07-13 08:33:14 +03:00
committed by GitHub
parent 7888dd65b3
commit 7e248d4e9b
4 changed files with 387 additions and 9 deletions
@@ -47,7 +47,9 @@ other runtime API.
- **Anthropic** (`type: api`): `/v1/messages` with `x-api-key`.
- **Google** (`type: api`): `generateContent` with `x-goog-api-key`.
- Everything else: OpenAI-compatible `/chat/completions` against the
provider's models.dev base URL with `Authorization: Bearer <key>`.
provider's base URL, resolved from (1) `provider.<id>.options.baseURL`
in the OpenCode config, (2) the hardcoded `https://api.openai.com/v1`
endpoint, or (3) the provider's `api` field from the models.dev catalog.
- `catalog.js` — models.dev catalog via the shared in-process cache
(`../opencode/models-metadata.js`, also serving
`/api/openchamber/models-metadata`).