Skip to content

Commit f305e70

Browse files
authored
feat(models): add Claude Mythos 5 support (#101238)
1 parent 090c3a2 commit f305e70

39 files changed

Lines changed: 847 additions & 206 deletions

‎docs/providers/anthropic.md‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ OpenClaw release:
185185
</Tab>
186186
</Tabs>
187187

188-
## Thinking defaults (Claude Sonnet 5, Fable 5, 4.8, and 4.6)
188+
## Thinking defaults (Claude Sonnet 5, Mythos 5, Fable 5, 4.8, and 4.6)
189189

190190
`anthropic/claude-sonnet-5` uses adaptive thinking at `high` effort by default.
191191
Use `/think off` to disable thinking, or `/think xhigh|max` for the model's
@@ -201,6 +201,12 @@ effort. Anthropic does not allow thinking to be disabled for this model, so
201201
omits custom temperature values for Fable 5 requests, since Anthropic rejects
202202
a temperature override on any thinking-enabled request.
203203

204+
`anthropic/claude-mythos-5` is a limited-access model with the same always-on
205+
adaptive-thinking contract. OpenClaw defaults to `high`, maps `/think off` and
206+
`/think minimal` to `low`, and omits caller-selected sampling parameters.
207+
The catalog publishes its 1,000,000-token context window, 128,000-token output
208+
limit, image input, and `$10/$50` input/output pricing.
209+
204210
Claude Opus 4.8 keeps thinking off by default in OpenClaw. When you explicitly
205211
enable adaptive thinking with `/think high|xhigh|max`, OpenClaw sends
206212
Anthropic's Opus 4.8 effort values; Claude 4.6 models (Opus 4.6 and Sonnet 4.6)
@@ -414,17 +420,19 @@ OpenClaw supports Anthropic's prompt caching feature for API-key auth.
414420
</Accordion>
415421

416422
<Accordion title="1M context window">
417-
Claude Sonnet 5 has an exact 1,000,000-token input window and supports up to
418-
128,000 output tokens. Anthropic's 1M context window is also GA on Claude 4.x
419-
models with adaptive thinking: Opus 4.8, Opus 4.7, Opus 4.6, and Sonnet 4.6.
420-
OpenClaw sizes these models automatically, no `params.context1m` needed:
423+
Claude Sonnet 5, Mythos 5, and Fable 5 have an exact 1,000,000-token input
424+
window and support up to 128,000 output tokens. Anthropic's 1M context
425+
window is also GA on Claude 4.x models with adaptive thinking: Opus 4.8,
426+
Opus 4.7, Opus 4.6, and Sonnet 4.6. OpenClaw sizes these models
427+
automatically, no `params.context1m` needed:
421428

422429
```json5
423430
{
424431
agents: {
425432
defaults: {
426433
models: {
427434
"anthropic/claude-sonnet-5": {},
435+
"anthropic/claude-mythos-5": {},
428436
"anthropic/claude-opus-4-6": {},
429437
},
430438
},

‎docs/providers/bedrock-mantle.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ summary: "Use Amazon Bedrock Mantle OpenAI-compatible and Claude Messages models
33
read_when:
44
- You want to use Bedrock Mantle hosted OSS models with OpenClaw
55
- You need the Mantle OpenAI-compatible endpoint for GPT-OSS, Qwen, Kimi, or GLM
6-
- You want to use Claude Sonnet 5 through Amazon Bedrock Mantle
6+
- You want to use Claude Sonnet 5 or Mythos 5 through Amazon Bedrock Mantle
77
title: "Amazon Bedrock Mantle"
88
---
99

@@ -162,10 +162,11 @@ want to use.
162162
</Accordion>
163163

164164
<Accordion title="Claude via the Anthropic Messages route">
165-
When automatic discovery owns the model list, OpenClaw appends three Claude
165+
When automatic discovery owns the model list, OpenClaw appends four Claude
166166
models after a successful lookup, regardless of what `/v1/models` returns:
167167
`amazon-bedrock-mantle/anthropic.claude-sonnet-5` (Claude Sonnet 5),
168168
`amazon-bedrock-mantle/anthropic.claude-opus-4-7` (Claude Opus 4.7), and
169+
`amazon-bedrock-mantle/anthropic.claude-mythos-5` (Claude Mythos 5), plus
169170
`amazon-bedrock-mantle/anthropic.claude-mythos-preview` (Claude Mythos
170171
Preview). They use the `anthropic-messages` API surface and stream through
171172
the same bearer-authenticated Anthropic-compatible endpoint
@@ -177,6 +178,11 @@ want to use.
177178
route cannot disable thinking. OpenClaw also omits custom temperature for
178179
Sonnet 5 requests.
179180

181+
Claude Mythos 5 is limited access. It publishes a 1,000,000-token context
182+
window and 128,000-token output limit, always uses adaptive thinking, maps
183+
`/think off` and `/think minimal` to `low`, and omits caller-selected
184+
sampling parameters.
185+
180186
Claude Mythos Preview always requests reasoning, defaulting to `high`
181187
effort when no `/think` level is set (mapped from `xhigh`/`max` down to
182188
`high`, and `minimal` up to `low`). Opus 4.7 on Mantle streams without

‎docs/providers/bedrock.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,20 @@ openclaw models list
347347

348348
</Accordion>
349349

350+
<Accordion title="Claude Mythos 5">
351+
Claude Mythos 5 is available through Bedrock only for accounts with the
352+
required limited-access approval. OpenClaw recognizes the foundation model
353+
`anthropic.claude-mythos-5` and regional or global inference profiles such
354+
as `us.anthropic.claude-mythos-5`.
355+
356+
OpenClaw applies the 1,000,000-token context window, 128,000-token output
357+
limit, image input, prompt caching, refusal-safe streaming, and native
358+
effort levels. Adaptive thinking is always enabled: `/think off` and
359+
`/think minimal` map to `low`, while `xhigh` and `max` remain available.
360+
Custom sampling and forced tool choice values are omitted.
361+
362+
</Accordion>
363+
350364
<Accordion title="Claude Sonnet 5">
351365
AWS documents Sonnet 5 for both the
352366
[`bedrock-runtime` and `bedrock-mantle` endpoints](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-anthropic-claude-sonnet-5.html).

‎extensions/amazon-bedrock-mantle/discovery.test.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ describe("bedrock mantle discovery", () => {
520520
expect(provider?.api).toBe("openai-completions");
521521
expect(provider?.auth).toBe("api-key");
522522
expect(provider?.apiKey).toBe("env:AWS_BEARER_TOKEN_BEDROCK");
523-
expect(provider?.models).toHaveLength(4);
523+
expect(provider?.models).toHaveLength(5);
524524
const sonnet = provider?.models?.find((model) => model.id === "anthropic.claude-sonnet-5");
525525
expect(sonnet).toMatchObject({
526526
api: "anthropic-messages",
@@ -536,10 +536,20 @@ describe("bedrock mantle discovery", () => {
536536
expect(opus?.api).toBe("anthropic-messages");
537537
expect(opus?.reasoning).toBe(false);
538538
expect(opus).not.toHaveProperty("baseUrl");
539-
const mythos = provider?.models?.find(
539+
const mythos = provider?.models?.find((model) => model.id === "anthropic.claude-mythos-5");
540+
expect(mythos).toMatchObject({
541+
api: "anthropic-messages",
542+
reasoning: true,
543+
params: { canonicalModelId: "claude-mythos-5" },
544+
cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
545+
contextWindow: 1_000_000,
546+
maxTokens: 128_000,
547+
thinkingLevelMap: { off: "low", minimal: "low", xhigh: "xhigh", max: "max" },
548+
});
549+
const mythosPreview = provider?.models?.find(
540550
(model) => model.id === "anthropic.claude-mythos-preview",
541551
);
542-
expect(mythos).toMatchObject({
552+
expect(mythosPreview).toMatchObject({
543553
api: "anthropic-messages",
544554
reasoning: true,
545555
params: { canonicalModelId: "claude-mythos-preview" },

‎extensions/amazon-bedrock-mantle/discovery.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,18 @@ export async function resolveImplicitMantleProvider(params: {
463463
contextWindow: 1_000_000,
464464
maxTokens: 128_000,
465465
},
466+
{
467+
id: "anthropic.claude-mythos-5",
468+
name: "Claude Mythos 5",
469+
api: "anthropic-messages" as const,
470+
reasoning: true,
471+
params: { canonicalModelId: "claude-mythos-5" },
472+
input: ["text", "image"],
473+
cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
474+
contextWindow: 1_000_000,
475+
maxTokens: 128_000,
476+
thinkingLevelMap: { off: "low", minimal: "low", xhigh: "xhigh", max: "max" },
477+
},
466478
{
467479
id: "anthropic.claude-mythos-preview",
468480
name: "Claude Mythos Preview",

‎extensions/amazon-bedrock-mantle/mantle-anthropic.runtime.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,40 @@ describe("createMantleAnthropicStreamFn", () => {
213213
expect(streamOptions.effort).toBe("low");
214214
});
215215

216+
it.each([
217+
{ reasoning: undefined, effort: "high" },
218+
{ reasoning: "off" as const, effort: "low" },
219+
{ reasoning: "max" as const, effort: "max" },
220+
])("maps Mythos 5 $reasoning reasoning to adaptive $effort", ({ reasoning, effort }) => {
221+
const model = createTestModel({
222+
id: "anthropic.claude-mythos-5",
223+
name: "Claude Mythos 5",
224+
reasoning: true,
225+
params: { canonicalModelId: "claude-mythos-5" },
226+
thinkingLevelMap: { off: "low", minimal: "low", xhigh: "xhigh", max: "max" },
227+
});
228+
const deps = createTestDeps();
229+
deps.stream.mockReturnValue({ kind: "anthropic-stream" } as never);
230+
231+
void createMantleAnthropicStreamFn(deps)(
232+
model,
233+
{ messages: [] },
234+
{
235+
apiKey: "bedrock-bearer-token",
236+
maxTokens: 1_000,
237+
temperature: 0.2,
238+
...(reasoning ? { reasoning } : {}),
239+
},
240+
);
241+
242+
const streamOptions = firstStreamOptions(deps);
243+
expect(streamOptions.thinkingEnabled).toBe(true);
244+
expect(streamOptions.effort).toBe(effort);
245+
expect(streamOptions.maxTokens).toBe(1_000);
246+
expect(streamOptions).not.toHaveProperty("thinkingBudgetTokens");
247+
expect(streamOptions.temperature).toBeUndefined();
248+
});
249+
216250
it("normalizes Mantle provider URLs to the Anthropic endpoint", () => {
217251
expect(resolveMantleAnthropicBaseUrl("https://bedrock-mantle.us-east-1.api.aws/v1")).toBe(
218252
"https://bedrock-mantle.us-east-1.api.aws/anthropic",

‎extensions/amazon-bedrock-mantle/mantle-anthropic.runtime.ts‎

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import {
1010
type SimpleStreamOptions,
1111
type ThinkingLevel,
1212
} from "openclaw/plugin-sdk/llm";
13-
import { resolveClaudeSonnet5ModelIdentity } from "openclaw/plugin-sdk/provider-model-shared";
13+
import {
14+
requiresClaudeDefaultSampling,
15+
resolveClaudeMythos5ModelIdentity,
16+
resolveClaudeSonnet5ModelIdentity,
17+
} from "openclaw/plugin-sdk/provider-model-shared";
1418

1519
const MANTLE_ANTHROPIC_BETA = "fine-grained-tool-streaming-2025-05-14";
1620
type AnthropicOptions = ConstructorParameters<typeof Anthropic>[0];
@@ -33,7 +37,7 @@ function isClaudeSonnet5Model(model: Model): boolean {
3337
}
3438

3539
function requiresDefaultSampling(model: Model): boolean {
36-
return model.id.includes("claude-opus-4-7") || isClaudeSonnet5Model(model);
40+
return requiresClaudeDefaultSampling(model);
3741
}
3842

3943
function isClaudeMythosPreviewModel(model: Model): boolean {
@@ -49,6 +53,14 @@ function isClaudeMythosPreviewModel(model: Model): boolean {
4953
);
5054
}
5155

56+
function isClaudeMythos5Model(model: Model): boolean {
57+
return resolveClaudeMythos5ModelIdentity(model) !== undefined;
58+
}
59+
60+
function requiresClaudeMythosAdaptiveThinking(model: Model): boolean {
61+
return isClaudeMythos5Model(model) || isClaudeMythosPreviewModel(model);
62+
}
63+
5264
function resolveMantleReasoning(
5365
model: Model,
5466
options: SimpleStreamOptions | undefined,
@@ -57,21 +69,19 @@ function resolveMantleReasoning(
5769
return undefined;
5870
}
5971
const sonnet5 = isClaudeSonnet5Model(model);
60-
const reasoning =
61-
options?.reasoning ?? (isClaudeMythosPreviewModel(model) || sonnet5 ? "high" : undefined);
72+
const mythosPreview = isClaudeMythosPreviewModel(model);
73+
const mandatoryMythos = isClaudeMythos5Model(model) || mythosPreview;
74+
const reasoning = options?.reasoning ?? (mandatoryMythos || sonnet5 ? "high" : undefined);
6275
if (sonnet5) {
6376
return reasoning === "off" || reasoning === "minimal" ? "low" : reasoning;
6477
}
65-
if (!isClaudeMythosPreviewModel(model)) {
78+
if (!mandatoryMythos) {
6679
return reasoning;
6780
}
68-
if (reasoning === "off") {
69-
return "high";
70-
}
71-
if (reasoning === "minimal") {
81+
if (reasoning === "off" || reasoning === "minimal") {
7282
return "low";
7383
}
74-
return reasoning === "xhigh" || reasoning === "max" ? "high" : reasoning;
84+
return mythosPreview && (reasoning === "xhigh" || reasoning === "max") ? "high" : reasoning;
7585
}
7686

7787
function mapSonnet5Effort(
@@ -107,7 +117,9 @@ function buildMantleAnthropicBaseOptions(
107117
...(requiresDefaultSampling(model) ? {} : { temperature: options?.temperature }),
108118
maxTokens:
109119
options?.maxTokens ||
110-
(isClaudeSonnet5Model(model) ? model.maxTokens : Math.min(model.maxTokens, 32_000)),
120+
(isClaudeSonnet5Model(model) || isClaudeMythos5Model(model)
121+
? model.maxTokens
122+
: Math.min(model.maxTokens, 32_000)),
111123
signal: options?.signal,
112124
apiKey,
113125
cacheRetention: options?.cacheRetention,
@@ -172,6 +184,7 @@ export function createMantleAnthropicStreamFn(deps?: {
172184
const streamClient = client as unknown as Anthropic;
173185
const reasoning = resolveMantleReasoning(model, options);
174186
const sonnet5 = isClaudeSonnet5Model(model);
187+
const mythos5 = isClaudeMythos5Model(model);
175188
if (!reasoning || reasoning === "off") {
176189
return streamFn(model as Model<"anthropic-messages">, context, {
177190
...base,
@@ -180,12 +193,12 @@ export function createMantleAnthropicStreamFn(deps?: {
180193
});
181194
}
182195

183-
if (sonnet5) {
196+
if (sonnet5 || mythos5) {
184197
return streamFn(model as Model<"anthropic-messages">, context, {
185198
...base,
186199
client: streamClient,
187200
thinkingEnabled: true,
188-
effort: mapSonnet5Effort(reasoning),
201+
effort: sonnet5 ? mapSonnet5Effort(reasoning) : reasoning,
189202
});
190203
}
191204

@@ -200,7 +213,7 @@ export function createMantleAnthropicStreamFn(deps?: {
200213
client: streamClient,
201214
maxTokens: adjusted.maxTokens,
202215
thinkingEnabled: true,
203-
...(isClaudeMythosPreviewModel(model) ? { effort: reasoning } : {}),
216+
...(requiresClaudeMythosAdaptiveThinking(model) ? { effort: reasoning } : {}),
204217
thinkingBudgetTokens: adjusted.thinkingBudget,
205218
});
206219
};

‎extensions/amazon-bedrock/bedrock-options.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ export function supportsBedrockPromptCaching(modelId: string, modelName?: string
4141
if (candidates.some((s) => s.includes("-4-"))) {
4242
return true;
4343
}
44-
if (candidates.some((s) => s.includes("claude-fable-5") || s.includes("claude-sonnet-5"))) {
44+
if (
45+
candidates.some(
46+
(candidate) =>
47+
candidate.includes("claude-fable-5") ||
48+
candidate.includes("claude-mythos-5") ||
49+
candidate.includes("claude-sonnet-5"),
50+
)
51+
) {
4552
return true;
4653
}
4754
if (candidates.some((s) => s.includes("claude-3-7-sonnet"))) {

0 commit comments

Comments
 (0)