-
Notifications
You must be signed in to change notification settings - Fork 868
Add Anthropic Claude Fable 5 and 5.1 API support #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,8 @@ export const customApiModelKeys = ['customModel'] | |
| export const ollamaApiModelKeys = ['ollamaModel'] | ||
| export const azureOpenAiApiModelKeys = ['azureOpenAi'] | ||
| export const claudeApiModelKeys = [ | ||
| 'claudeFable51Api', | ||
| 'claudeFable5Api', | ||
| 'claudeOpus41Api', | ||
| 'claudeOpus45Api', | ||
| 'claudeOpus46Api', | ||
|
|
@@ -338,6 +340,14 @@ export const Models = { | |
| chatgptApi4_1_nano: { value: 'gpt-4.1-nano', desc: 'OpenAI (GPT-4.1 nano)' }, | ||
|
|
||
| claude2WebFree: { value: '', desc: 'Claude.ai (Web)' }, | ||
| claudeFable51Api: { | ||
| value: 'claude-fable-5-1', | ||
| desc: 'Anthropic (Claude Fable 5.1)', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Fable labels lack localization The new Claude Fable 5 and Claude Fable 5.1 display labels are passed through t(), but neither key exists in the English localization catalog. This leaves new user-facing model labels outside the required localization workflow. Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When either new preset is displayed, AGENTS.md reference: AGENTS.md:L211-L213 Useful? React with 👍 / 👎. |
||
| }, | ||
| claudeFable5Api: { | ||
| value: 'claude-fable-5', | ||
| desc: 'Anthropic (Claude Fable 5)', | ||
| }, | ||
| claudeOpus41Api: { | ||
| value: 'claude-opus-4-1-20250805', | ||
| desc: 'Anthropic (Claude Opus 4.1)', | ||
|
|
@@ -751,6 +761,7 @@ export const defaultApiModeIds = [ | |
| 'chatgptApi5_6Luna', | ||
| 'xaiGrok4_6', | ||
| 'xaiGrok4_5', | ||
| 'claudeFable51Api', | ||
| 'claudeOpus5Api', | ||
| 'claudeSonnet5Api', | ||
| 'claudeHaiku45Api', | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||||||
| import assert from 'node:assert/strict' | ||||||||||
| import { beforeEach, test } from 'node:test' | ||||||||||
| import { generateAnswersWithClaudeApi } from '../../../../src/services/apis/claude-api.mjs' | ||||||||||
| import { createFakePort } from '../../helpers/port.mjs' | ||||||||||
| import { createMockSseResponse } from '../../helpers/sse-response.mjs' | ||||||||||
|
|
||||||||||
| const setStorage = (values) => { | ||||||||||
| globalThis.__TEST_BROWSER_SHIM__.replaceStorage(values) | ||||||||||
| } | ||||||||||
|
|
||||||||||
| beforeEach(() => { | ||||||||||
| globalThis.__TEST_BROWSER_SHIM__.clearStorage() | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| test('claude-api: supports Fable models with adaptive thinking defaults', async (t) => { | ||||||||||
| t.mock.method(console, 'debug', () => {}) | ||||||||||
|
|
||||||||||
| for (const [modelName, model] of [ | ||||||||||
| ['claudeFable5Api', 'claude-fable-5'], | ||||||||||
| ['claudeFable51Api', 'claude-fable-5-1'], | ||||||||||
| ]) { | ||||||||||
| await t.test(modelName, async (t) => { | ||||||||||
| setStorage({ | ||||||||||
| customClaudeApiUrl: 'https://api.anthropic.com', | ||||||||||
| claudeApiKey: 'sk-ant-test', | ||||||||||
|
Comment on lines
+24
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Use the configuration field names consumed by the request builder.
Suggested correction- customClaudeApiUrl: 'https://api.anthropic.com',
- claudeApiKey: 'sk-ant-test',
+ customAnthropicApiUrl: 'https://api.anthropic.com',
+ anthropicApiKey: 'sk-ant-test',📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| maxConversationContextLength: 3, | ||||||||||
| maxResponseTokenLength: 1024, | ||||||||||
| temperatureOverrideEnabled: true, | ||||||||||
| temperature: 0.9, | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| const session = { | ||||||||||
| modelName, | ||||||||||
| conversationRecords: [], | ||||||||||
| isRetry: false, | ||||||||||
| } | ||||||||||
| const port = createFakePort() | ||||||||||
|
|
||||||||||
| let capturedInit | ||||||||||
| t.mock.method(globalThis, 'fetch', async (_input, init) => { | ||||||||||
| capturedInit = init | ||||||||||
| return createMockSseResponse([ | ||||||||||
| 'data: {"type":"content_block_delta","delta":{"type":"text_delta","text":"OK"}}\n\n', | ||||||||||
| 'data: {"type":"message_delta","delta":{"stop_reason":"end_turn"}}\n\n', | ||||||||||
| 'data: {"type":"message_stop"}\n\n', | ||||||||||
| ]) | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| await generateAnswersWithClaudeApi(port, 'Q', session) | ||||||||||
|
|
||||||||||
| const body = JSON.parse(capturedInit.body) | ||||||||||
| assert.equal(body.model, model) | ||||||||||
| assert.equal(body.max_tokens, 1024) | ||||||||||
| assert.equal(body.stream, true) | ||||||||||
| assert.equal(Object.hasOwn(body, 'temperature'), false) | ||||||||||
| assert.equal(Object.hasOwn(body, 'thinking'), false) | ||||||||||
| }) | ||||||||||
| } | ||||||||||
| }) | ||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two new
descstrings (Anthropic (Claude Fable 5.1),Anthropic (Claude Fable 5)) aren't registered insrc/_locales/en/main.json, unlike every sibling Anthropic model desc (e.g.Anthropic (Claude Opus 5)aten/main.json:205has a matching identity key). Functionally invisible today —fallbackLng: 'en'makes i18next return the key string, which is the English text — but it breaks the repo's documented convention of treatingen/main.jsonas the source of truth for model display labels.Technical details