Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat: support Claude Fable 5 pricing (#3982)

Bohan Jiangb1c8eb5f1173
diff --git a/packages/views/runtimes/utils.test.ts b/packages/views/runtimes/utils.test.ts
index 9c65facb7f..9f1d742002 100644
--- a/packages/views/runtimes/utils.test.ts
+++ b/packages/views/runtimes/utils.test.ts
@@ -129,6 +129,18 @@ describe("estimateCost", () => {
expect(cost).toBeCloseTo(5 + 25, 5);
});
+ it("prices Claude Fable 5 at the Mythos-class tier", () => {
+ const cost = estimateCost({
+ ...zeroUsage,
+ model: "claude-fable-5",
+ input_tokens: 1_000_000,
+ output_tokens: 1_000_000,
+ cache_read_tokens: 1_000_000,
+ cache_write_tokens: 1_000_000,
+ });
+ expect(cost).toBeCloseTo(10 + 50 + 1 + 12.5, 5);
+ });
+
it("prices the provider-prefixed Anthropic form (anthropic/claude-sonnet-4.6)", () => {
// openclaw / opencode emit `<provider>/<model>`. Same SKU as the
// bare form, must hit the same rate.
@@ -346,6 +358,7 @@ describe("estimateCost", () => {
describe("isModelPriced", () => {
it("recognises both Claude and Codex/GPT families", () => {
+ expect(isModelPriced("claude-fable-5")).toBe(true);
expect(isModelPriced("claude-sonnet-4-6")).toBe(true);
expect(isModelPriced("gpt-5-codex")).toBe(true);
expect(isModelPriced("gpt-5-mini")).toBe(true);
@@ -369,6 +382,7 @@ describe("isModelPriced", () => {
it("recognises provider-prefixed Anthropic IDs (openclaw / opencode form)", () => {
// openclaw / opencode emit `<provider>/<model>` in `meta.agentMeta.model`.
// The provider prefix is routing metadata, not part of the SKU.
+ expect(isModelPriced("anthropic/claude-fable-5")).toBe(true);
expect(isModelPriced("anthropic/claude-opus-4.7")).toBe(true);
expect(isModelPriced("anthropic/claude-sonnet-4-6")).toBe(true);
});
diff --git a/packages/views/runtimes/utils.ts b/packages/views/runtimes/utils.ts
index c7166c6153..37e8e4e678 100644
--- a/packages/views/runtimes/utils.ts
+++ b/packages/views/runtimes/utils.ts
@@ -151,7 +151,9 @@ const MODEL_PRICING: Record<
string,
{ input: number; output: number; cacheRead: number; cacheWrite: number }
> = {
- // -- Anthropic: current generation (4.5+ — Opus dropped from 15/75 to 5/25 here) --
+ // -- Anthropic: current generation. Fable 5 is a Mythos-class SKU at 10/50;
+ // Opus 4.5+ stays on the lower 5/25 Opus tier. --
+ "claude-fable-5": { input: 10, output: 50, cacheRead: 1.00, cacheWrite: 12.50 },
"claude-haiku-4-5": { input: 1, output: 5, cacheRead: 0.10, cacheWrite: 1.25 },
"claude-sonnet-4-5": { input: 3, output: 15, cacheRead: 0.30, cacheWrite: 3.75 },
"claude-sonnet-4-6": { input: 3, output: 15, cacheRead: 0.30, cacheWrite: 3.75 },
diff --git a/server/internal/metrics/pricing.go b/server/internal/metrics/pricing.go
index ac85d150b7..3ed7122140 100644
--- a/server/internal/metrics/pricing.go
+++ b/server/internal/metrics/pricing.go
@@ -20,6 +20,8 @@ var modelPrices = map[string]ModelPrice{
"openai:gpt-5.4-mini": {Provider: "openai", Model: "gpt-5.4-mini", InputPerM: 0.75, CacheReadPerM: 0.075, CacheWritePerM: 0.075, OutputPerM: 4.50},
"openai:gpt-5.3-codex": {Provider: "openai", Model: "gpt-5.3-codex", InputPerM: 1.75, CacheReadPerM: 0.175, CacheWritePerM: 0.175, OutputPerM: 14.00},
"openai:gpt-5.2-codex": {Provider: "openai", Model: "gpt-5.2-codex", InputPerM: 1.75, CacheReadPerM: 0.175, CacheWritePerM: 0.175, OutputPerM: 14.00},
+ "anthropic:claude-fable-5": {Provider: "anthropic", Model: "claude-fable-5", InputPerM: 10.00, CacheReadPerM: 1.00, CacheWritePerM: 12.50, OutputPerM: 50.00},
+ "anthropic:claude-opus-4.8": {Provider: "anthropic", Model: "claude-opus-4.8", InputPerM: 5.00, CacheReadPerM: 0.50, CacheWritePerM: 6.25, OutputPerM: 25.00},
"anthropic:claude-opus-4.7": {Provider: "anthropic", Model: "claude-opus-4.7", InputPerM: 5.00, CacheReadPerM: 0.50, CacheWritePerM: 6.25, OutputPerM: 25.00},
"anthropic:claude-opus-4.6": {Provider: "anthropic", Model: "claude-opus-4.6", InputPerM: 5.00, CacheReadPerM: 0.50, CacheWritePerM: 6.25, OutputPerM: 25.00},
"anthropic:claude-opus-4.5": {Provider: "anthropic", Model: "claude-opus-4.5", InputPerM: 5.00, CacheReadPerM: 0.50, CacheWritePerM: 6.25, OutputPerM: 25.00},
@@ -45,6 +47,8 @@ var modelAliasRules = []struct {
{regexp.MustCompile(`(^|/|:)gpt-5[.-]4-mini($|[^a-z0-9])`), "openai:gpt-5.4-mini"},
{regexp.MustCompile(`(^|/|:)gpt-5[.-]3-codex$`), "openai:gpt-5.3-codex"},
{regexp.MustCompile(`(^|/|:)gpt-5[.-]2-codex$`), "openai:gpt-5.2-codex"},
+ {regexp.MustCompile(`claude-fable-5`), "anthropic:claude-fable-5"},
+ {regexp.MustCompile(`claude-opus-4[-.]8`), "anthropic:claude-opus-4.8"},
{regexp.MustCompile(`claude-opus-4[-.]7`), "anthropic:claude-opus-4.7"},
{regexp.MustCompile(`claude-opus-4[-.]6`), "anthropic:claude-opus-4.6"},
{regexp.MustCompile(`claude-opus-4[-.]5`), "anthropic:claude-opus-4.5"},
diff --git a/server/internal/metrics/pricing_test.go b/server/internal/metrics/pricing_test.go
new file mode 100644
index 0000000000..e3d4d23dc9
--- /dev/null
+++ b/server/internal/metrics/pricing_test.go
@@ -0,0 +1,33 @@
+package metrics
+
+import "testing"
+
+func TestPriceForModelAliasAnthropicFableAndOpus48(t *testing.T) {
+ cases := []struct {
+ model string
+ want ModelPrice
+ }{
+ {
+ model: "claude-fable-5",
+ want: ModelPrice{Provider: "anthropic", Model: "claude-fable-5", InputPerM: 10, CacheReadPerM: 1, CacheWritePerM: 12.5, OutputPerM: 50},
+ },
+ {
+ model: "anthropic/claude-fable-5",
+ want: ModelPrice{Provider: "anthropic", Model: "claude-fable-5", InputPerM: 10, CacheReadPerM: 1, CacheWritePerM: 12.5, OutputPerM: 50},
+ },
+ {
+ model: "claude-opus-4-8",
+ want: ModelPrice{Provider: "anthropic", Model: "claude-opus-4.8", InputPerM: 5, CacheReadPerM: 0.5, CacheWritePerM: 6.25, OutputPerM: 25},
+ },
+ }
+
+ for _, tc := range cases {
+ got, ok := PriceForModelAlias(tc.model)
+ if !ok {
+ t.Fatalf("PriceForModelAlias(%q) did not resolve", tc.model)
+ }
+ if got != tc.want {
+ t.Fatalf("PriceForModelAlias(%q) = %+v, want %+v", tc.model, got, tc.want)
+ }
+ }
+}
diff --git a/server/pkg/agent/models.go b/server/pkg/agent/models.go
index 2cafc3c1d9..fea6d3abd1 100644
--- a/server/pkg/agent/models.go
+++ b/server/pkg/agent/models.go
@@ -211,6 +211,7 @@ func discoveryCacheKey(providerType, executablePath string) string {
func claudeStaticModels() []Model {
return []Model{
{ID: "claude-sonnet-4-6", Label: "Claude Sonnet 4.6", Provider: "anthropic", Default: true},
+ {ID: "claude-fable-5", Label: "Claude Fable 5", Provider: "anthropic"},
{ID: "claude-opus-4-8", Label: "Claude Opus 4.8", Provider: "anthropic"},
{ID: "claude-opus-4-7", Label: "Claude Opus 4.7", Provider: "anthropic"},
{ID: "claude-haiku-4-5-20251001", Label: "Claude Haiku 4.5", Provider: "anthropic"},
diff --git a/server/pkg/agent/models_test.go b/server/pkg/agent/models_test.go
index 530679da7d..45273dd8c7 100644
--- a/server/pkg/agent/models_test.go
+++ b/server/pkg/agent/models_test.go
@@ -57,6 +57,29 @@ func TestListModelsCopilotFallsBackToStatic(t *testing.T) {
}
}
+func TestClaudeStaticModelsExposesFable5(t *testing.T) {
+ models := claudeStaticModels()
+ ids := map[string]Model{}
+ defaults := 0
+ for _, m := range models {
+ ids[m.ID] = m
+ if m.Default {
+ defaults++
+ }
+ }
+
+ fable, ok := ids["claude-fable-5"]
+ if !ok {
+ t.Fatalf("missing Claude Fable 5 in: %+v", models)
+ }
+ if fable.Label != "Claude Fable 5" || fable.Provider != "anthropic" || fable.Default {
+ t.Errorf("unexpected Fable entry: %+v", fable)
+ }
+ if defaults != 1 || !ids["claude-sonnet-4-6"].Default {
+ t.Errorf("expected Sonnet 4.6 to remain the sole default, got defaults=%d models=%+v", defaults, models)
+ }
+}
+
func TestGeminiStaticModelsExposesAliasesAndGemini3(t *testing.T) {
// Gemini CLI has no `models list` subcommand, so we expose the
// CLI's own aliases (auto / pro / flash / flash-lite) plus