Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backends/claude-code/models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const CLAUDE_CODE_MODELS = [
{ value: 'claude-fable-5', label: 'Claude Fable 5' },
{ value: 'claude-opus-4-8', label: 'Claude Opus 4.8' },
{ value: 'claude-opus-4-8[1m]', label: 'Claude Opus 4.8 (1M context)' },
{ value: 'claude-opus-4-7', label: 'Claude Opus 4.7' },
Expand Down
3 changes: 3 additions & 0 deletions src/backends/codex/models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const CODEX_MODELS = [
{ value: 'gpt-5.6-sol', label: 'GPT-5.6 Sol' },
{ value: 'gpt-5.6-terra', label: 'GPT-5.6 Terra' },
{ value: 'gpt-5.6-luna', label: 'GPT-5.6 Luna' },
{ value: 'gpt-5.5', label: 'GPT-5.5' },
{ value: 'gpt-5.4', label: 'GPT-5.4' },
{ value: 'gpt-5.4-mini', label: 'GPT-5.4 mini' },
Expand Down
7 changes: 7 additions & 0 deletions src/config/rateLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export const MODEL_RATE_LIMITS: ModelRateLimits = {
safetyMargin: 0.8, // Conservative - start throttling at 80%
},

// Claude Fable 5 (Tier 1: 50 RPM, 10K TPM — priciest Anthropic model, throttle-sensitive)
'anthropic:claude-fable-5': {
requestsPerMinute: 50,
tokensPerMinute: 10_000,
safetyMargin: 0.85,
},

// Claude Opus 4.8 (Tier 1: 50 RPM, 10K TPM — Opus is throttle-sensitive)
'anthropic:claude-opus-4-8': {
requestsPerMinute: 50,
Expand Down
11 changes: 11 additions & 0 deletions src/utils/llmMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import type { TokenUsage } from 'llmist';
* Prices as of January 2026.
*/
const MODEL_PRICING: Record<string, { input: number; output: number; cachedInput?: number }> = {
// Anthropic Claude Fable 5 — 1M context by default (max = default), priced at 2× Opus.
// Key matches toPricingKey('claude-fable-5') = 'anthropic:claude-fable-5' (no trailing
// date to strip). cachedInput follows the 0.1× convention used by every Anthropic row.
'anthropic:claude-fable-5': { input: 10.0, output: 50.0, cachedInput: 1.0 },

// Anthropic Claude 4 family
'anthropic:claude-opus-4-8': { input: 5.0, output: 25.0, cachedInput: 0.5 },
'anthropic:claude-opus-4-8[1m]': { input: 5.0, output: 25.0, cachedInput: 0.5 },
Expand All @@ -28,6 +33,12 @@ const MODEL_PRICING: Record<string, { input: number; output: number; cachedInput
// OpenAI — Codex CLI models (per developers.openai.com/codex/pricing, 2026-05-11).
// Rates are public metered API prices; we display API-equivalent cost regardless of
// subscription plan, consistent with how Anthropic Pro/Max users see costs for claude-code.
// GPT-5.6 family (GA 2026-07-09, per developers.openai.com/api/docs/pricing): three
// Sol/Terra/Luna tiers, 1M context on all three, cached-input reads at the standard 90%
// discount. There is no GPT-5.6 Codex-specific model — Codex runs these same three tiers.
'openai:gpt-5.6-sol': { input: 5.0, output: 30.0, cachedInput: 0.5 },
'openai:gpt-5.6-terra': { input: 2.5, output: 15.0, cachedInput: 0.25 },
'openai:gpt-5.6-luna': { input: 1.0, output: 6.0, cachedInput: 0.1 },
'openai:gpt-5.5': { input: 5.0, output: 30.0, cachedInput: 0.5 },
'openai:gpt-5.4': { input: 2.5, output: 15.0, cachedInput: 0.25 },
// gpt-5.4-mini: rates from developers.openai.com/api/docs/models/gpt-5.4-mini (2026-05-11).
Expand Down
9 changes: 8 additions & 1 deletion tests/unit/backends/claude-code.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ describe('buildSystemPrompt', () => {

describe('CLAUDE_CODE_MODELS constants', () => {
it('contains the expected models', () => {
expect(CLAUDE_CODE_MODELS).toHaveLength(10);
expect(CLAUDE_CODE_MODELS).toHaveLength(11);
});

it('includes Opus 4.8, Opus 4.7, and the 1M context variants', () => {
Expand All @@ -307,6 +307,12 @@ describe('CLAUDE_CODE_MODELS constants', () => {
expect(CLAUDE_CODE_MODEL_IDS).toContain('claude-opus-4-6[1m]');
});

it('includes Claude Fable 5 (1M context by default — no [1m] variant)', () => {
expect(CLAUDE_CODE_MODEL_IDS).toContain('claude-fable-5');
// Fable 5 is 1M-context by default, so a [1m] suffix would be redundant.
expect(CLAUDE_CODE_MODEL_IDS).not.toContain('claude-fable-5[1m]');
});

it('has value/label pairs', () => {
for (const m of CLAUDE_CODE_MODELS) {
expect(m.value).toBeTruthy();
Expand All @@ -325,6 +331,7 @@ describe('CLAUDE_CODE_MODELS constants', () => {

describe('resolveClaudeModel', () => {
it('passes through known Claude Code model IDs', () => {
expect(resolveClaudeModel('claude-fable-5')).toBe('claude-fable-5');
expect(resolveClaudeModel('claude-opus-4-8')).toBe('claude-opus-4-8');
expect(resolveClaudeModel('claude-opus-4-8[1m]')).toBe('claude-opus-4-8[1m]');
expect(resolveClaudeModel('claude-opus-4-7')).toBe('claude-opus-4-7');
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/backends/codex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ describe('resolveCodexModel', () => {
expect(resolveCodexModel(`openai:${DEFAULT_CODEX_MODEL}`)).toBe(DEFAULT_CODEX_MODEL);
});

it('passes through the GPT-5.6 Sol/Terra/Luna tiers (bare and openai:-prefixed)', () => {
for (const id of ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna']) {
expect(resolveCodexModel(id)).toBe(id);
expect(resolveCodexModel(`openai:${id}`)).toBe(id);
}
});

it('throws for incompatible models', () => {
expect(() => resolveCodexModel('openrouter:google/gemini-3-flash-preview')).toThrow(
'not compatible with the Codex engine',
Expand Down
Loading