* fix: strip model variant suffix for all auth methods, not just OAuth (#1097) The model ID variant suffix (e.g., `[1m]` in `claude-opus-4-6[1m]`) was only stripped for OAuth token auth. When using an API key, the suffix was sent to the Anthropic API as-is, causing a 400 "upstream_error" because `claude-opus-4-6[1m]` is not a valid API model ID. The default Anthropic model is `claude-opus-4-6[1m]` (1M context variant), so every API key user hits this on every request. Fix: strip `[...]` suffix unconditionally for all auth methods. * fix: update source-reading tests for post-refactor file locations triage-dispatch.test.ts: read auto-post-unit.ts (dispatch logic moved from auto.ts) and update comment string matches to reflect renamed section headers. token-profile.test.ts: read preferences-types.ts, preferences-validation.ts, and preferences-models.ts (GSDPreferences interface and validation logic split from preferences.ts).
This commit is contained in:
parent
b20e7b065a
commit
155c32e01b
1 changed files with 3 additions and 2 deletions
|
|
@ -709,10 +709,11 @@ function buildParams(
|
|||
options?: AnthropicOptions,
|
||||
): MessageCreateParamsStreaming {
|
||||
const { cacheControl } = getCacheControl(model.baseUrl, options?.cacheRetention);
|
||||
// For OAuth (Claude Max/Pro), strip variant suffixes like [1m] from model ID.
|
||||
// Strip variant suffixes like [1m] from model ID before sending to the API.
|
||||
// The API only accepts the base model ID (e.g. "claude-opus-4-6"),
|
||||
// not internal variant identifiers (e.g. "claude-opus-4-6[1m]").
|
||||
const apiModelId = isOAuthToken ? model.id.replace(/\[.*\]$/, "") : model.id;
|
||||
// This applies to all auth methods — API keys, OAuth, and Copilot alike.
|
||||
const apiModelId = model.id.replace(/\[.*\]$/, "");
|
||||
const params: MessageCreateParamsStreaming = {
|
||||
model: apiModelId,
|
||||
messages: convertMessages(context.messages, model, isOAuthToken, cacheControl),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue