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:
@@ -341,7 +341,10 @@ const callMessages = async ({ url, headers, modelID, prompt, system, maxOutputTo
|
||||
};
|
||||
|
||||
const callAnthropic = async ({ apiKey, baseURL, modelID, prompt, system, maxOutputTokens, responseSchema, timeoutMs, signal }) => callMessages({
|
||||
url: `${(baseURL || 'https://api.anthropic.com').replace(/\/+$/, '')}/v1/messages`,
|
||||
// Matches @ai-sdk/anthropic: baseURL is the full API prefix (commonly
|
||||
// already ending in /v1), so it gets /messages appended as-is rather than
|
||||
// having /v1/messages appended, which would double up a configured /v1.
|
||||
url: `${(baseURL || 'https://api.anthropic.com/v1').replace(/\/+$/, '')}/messages`,
|
||||
headers: {
|
||||
'x-api-key': apiKey,
|
||||
'anthropic-version': '2023-06-01',
|
||||
|
||||
Reference in New Issue
Block a user