fix(small-model): don't double up /v1 in Anthropic baseURL override

Match @ai-sdk/anthropic exactly: baseURL is the full API prefix, so
/messages is appended as-is instead of unconditionally inserting /v1,
which broke configs where the baseURL already ends in /v1 (the common
form OpenCode itself passes to @ai-sdk/anthropic).

Addresses review feedback from @btriapitsyn on PR #3000.
This commit is contained in:
Matt Peter
2026-08-25 09:42:28 -04:00
parent f459206e4a
commit 56b5e9971f
3 changed files with 27 additions and 3 deletions
@@ -103,7 +103,10 @@ other runtime API.
`https://chatgpt.com/backend-api/codex/responses` with
`ChatGPT-Account-Id`; expired tokens are refreshed against
`auth.openai.com` (single-flight) and written back to `auth.json`.
- **Anthropic** (`type: api`): `/v1/messages` with `x-api-key`.
- **Anthropic** (`type: api`): `/messages` with `x-api-key`, against
`provider.anthropic.options.baseURL` when configured (used as-is, matching
`@ai-sdk/anthropic` — no `/v1` is inserted) or `https://api.anthropic.com/v1`
otherwise.
- **Google** (`type: api`): `generateContent` with `x-goog-api-key`; Gemini 3
uses `thinkingLevel` while older Flash models use `thinkingBudget: 0`.
- Everything else: OpenAI-compatible `/chat/completions` against the