fix(models): align Command Code catalog metadata

This commit is contained in:
Patrick Wozniak
2026-08-25 15:54:09 +02:00
parent e26e06c582
commit 349e50f829
10 changed files with 399 additions and 63 deletions
+57
View File
@@ -51,6 +51,57 @@ export const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly CommandCod
"xiaomi/mimo-v2.5": ["text", "image"],
}
export const MODEL_REASONING: Readonly<Record<string, true>> = {
"claude-fable-5": true,
"claude-opus-4-7": true,
"claude-opus-4-8": true,
"claude-opus-5": true,
"claude-sonnet-4-6": true,
"claude-sonnet-5": true,
"deepseek/deepseek-v4-flash": true,
"deepseek/deepseek-v4-flash-vision-exp": true,
"deepseek/deepseek-v4-pro": true,
"google/gemini-3.1-flash-lite": true,
"google/gemini-3.5-flash": true,
"google/gemini-3.5-flash-lite": true,
"google/gemini-3.6-flash": true,
"google/gemini-3.7-flash": true,
"gpt-5.3-codex": true,
"gpt-5.4": true,
"gpt-5.4-mini": true,
"gpt-5.5": true,
"gpt-5.6-luna": true,
"gpt-5.6-sol": true,
"gpt-5.6-terra": true,
"meta/muse-spark-1.1": true,
"meta/muse-spark-1.2": true,
"meta/muse-spark-1.2-contributor": true,
"MiniMaxAI/MiniMax-M3": true,
"moonshotai/Kimi-K2.7-Code": true,
"moonshotai/Kimi-K2.7-Code-Highspeed": true,
"moonshotai/Kimi-K3": true,
"nvidia/nemotron-3-ultra-550b-a55b": true,
"poolside/laguna-s-2.1-free": true,
"Qwen/Qwen3.6-Max-Preview": true,
"Qwen/Qwen3.6-Plus": true,
"Qwen/Qwen3.7-Flash": true,
"Qwen/Qwen3.7-Max": true,
"Qwen/Qwen3.7-Plus": true,
"Qwen/Qwen3.8-27B": true,
"Qwen/Qwen3.8-Max": true,
"sakana/fugu-ultra": true,
"stealth/ox-alpha": true,
"stepfun/Step-3.5-Flash": true,
"stepfun/Step-3.7-Flash": true,
"tencent/hy3-paid": true,
"thinkingmachines/inkling": true,
"thinkingmachines/inkling-small": true,
"xai/grok-4.5": true,
"xai/grok-4.6": true,
"zai-org/GLM-5.2": true,
"zai-org/GLM-5.3": true,
}
export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasoningEffort[]>> = {
"claude-fable-5": ["low", "medium", "high", "xhigh", "max"],
"claude-opus-4-7": ["low", "medium", "high", "xhigh", "max"],
@@ -82,3 +133,9 @@ export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasonin
"zai-org/GLM-5.2": ["high", "max"],
"zai-org/GLM-5.3": ["low", "high", "max"],
}
export const MODEL_MAX_OUTPUT_TOKENS: Readonly<Record<string, number>> = {
"poolside/laguna-s-2.1-free": 32_768,
"Qwen/Qwen3.8-27B": 32_768,
"stealth/ox-alpha": 131_072,
}
+25 -14
View File
@@ -4,11 +4,13 @@ import { dirname } from "node:path"
import {
MODEL_EFFORTS,
MODEL_INPUT_MODALITIES,
MODEL_MAX_OUTPUT_TOKENS,
MODEL_REASONING,
type CommandCodeInputType,
type CommandCodeReasoningEffort,
} from "./commandcode-catalog.ts"
export { MODEL_EFFORTS, MODEL_INPUT_MODALITIES }
export { MODEL_EFFORTS, MODEL_INPUT_MODALITIES, MODEL_MAX_OUTPUT_TOKENS, MODEL_REASONING }
export type { CommandCodeInputType }
export const DEFAULT_PROVIDER_API_BASE = "https://api.commandcode.ai/provider/v1"
@@ -55,7 +57,7 @@ export function thinkingLevelMapForEfforts(
export interface ThinkingMetadata {
thinkingLevelMap: Partial<Record<PiThinkingLevel, string | null>>
thinking: {
thinking?: {
mode: "effort"
effortMap: Partial<Record<CommandCodeReasoningEffort, string>>
efforts: readonly CommandCodeReasoningEffort[]
@@ -64,19 +66,26 @@ export interface ThinkingMetadata {
export function thinkingMetadataForModel(modelId: string): ThinkingMetadata | undefined {
const efforts = MODEL_EFFORTS[modelId]
if (!efforts) return undefined
return {
thinkingLevelMap: thinkingLevelMapForEfforts(efforts),
thinking: {
mode: "effort",
effortMap: Object.fromEntries(efforts.map((effort) => [effort, effort])),
efforts,
},
if (efforts) {
return {
thinkingLevelMap: thinkingLevelMapForEfforts(efforts),
thinking: {
mode: "effort",
effortMap: Object.fromEntries(efforts.map((effort) => [effort, effort])),
efforts,
},
}
}
if (!isReasoningModel(modelId)) return undefined
return { thinkingLevelMap: thinkingLevelMapForEfforts([]) }
}
function isReasoningModel(modelId: string): boolean {
return MODEL_EFFORTS[modelId] !== undefined
return MODEL_REASONING[modelId] === true
}
function maxOutputTokensForModel(modelId: string, contextLength: number): number {
return Math.min(contextLength, MODEL_MAX_OUTPUT_TOKENS[modelId] ?? DEFAULT_MAX_OUTPUT_TOKENS)
}
interface ApiModel {
@@ -162,13 +171,15 @@ function parseCachedModel(value: unknown): CommandCodeModel {
const id = stringField(value, "id")
booleanField(value, "reasoning")
positiveNumberField(value, "maxTokens")
const contextWindow = positiveNumberField(value, "contextWindow")
return {
id,
name: stringField(value, "name"),
api: apiForModelId(id),
reasoning: isReasoningModel(id),
contextWindow: positiveNumberField(value, "contextWindow"),
maxTokens: positiveNumberField(value, "maxTokens"),
contextWindow,
maxTokens: maxOutputTokensForModel(id, contextWindow),
}
}
@@ -273,7 +284,7 @@ export function commandCodeModelsFromApiResponse(value: unknown): readonly Comma
api: apiForModelId(model.id),
reasoning: isReasoningModel(model.id),
contextWindow: model.contextLength,
maxTokens: Math.min(model.contextLength, DEFAULT_MAX_OUTPUT_TOKENS),
maxTokens: maxOutputTokensForModel(model.id, model.contextLength),
}))
}
+42 -2
View File
@@ -20,7 +20,7 @@ export interface TemporaryPricing {
}
export const PRICING_SOURCE_URL = "https://commandcode.ai/docs/resources/pricing-limits"
export const PRICING_LAST_VERIFIED = "2026-08-22"
export const PRICING_LAST_VERIFIED = "2026-08-25"
export const ZERO_MODEL_COST: CommandCodeModelCost = {
input: 0,
@@ -40,7 +40,7 @@ export const ZERO_MODEL_COST: CommandCodeModelCost = {
export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
// Free models
"poolside/laguna-s-2.1-free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
"inclusionai/ling-3.0-flash-free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
"stealth/ox-alpha": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
// Open and open-weight models
"tencent/hy3-paid": { input: 0.14, output: 0.58, cacheRead: 0.035, cacheWrite: 0 },
@@ -76,7 +76,14 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
cacheRead: 0.007,
cacheWrite: 0,
},
"deepseek/deepseek-v4-flash-vision-exp": {
input: 0.22,
output: 0.66,
cacheRead: 0.007,
cacheWrite: 0,
},
"Qwen/Qwen3.8-Max": { input: 2, output: 6, cacheRead: 0.25, cacheWrite: 2.5 },
"Qwen/Qwen3.8-27B": { input: 0.4, output: 3, cacheRead: 0.04, cacheWrite: 0 },
"Qwen/Qwen3.7-Max": { input: 2.5, output: 7.5, cacheRead: 0.5, cacheWrite: 3.13 },
"Qwen/Qwen3.7-Plus": {
input: 0.4,
@@ -142,6 +149,13 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
cacheWrite: 0,
},
"meta/muse-spark-1.1": { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 },
"meta/muse-spark-1.2": { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 },
"meta/muse-spark-1.2-contributor": {
input: 0.1,
output: 0.2,
cacheRead: 0.002,
cacheWrite: 0,
},
// Anthropic
// Introductory pricing through 2026-08-31.
@@ -168,6 +182,12 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
"gpt-5.4-mini": { input: 0.75, output: 4.5, cacheRead: 0.075, cacheWrite: 0 },
// Google and xAI
"google/gemini-3.7-flash": {
input: 0.75,
output: 3.75,
cacheRead: 0.075,
cacheWrite: 0.04167,
},
"google/gemini-3.6-flash": { input: 1.5, output: 7.5, cacheRead: 0.15, cacheWrite: 0 },
"google/gemini-3.5-flash": { input: 1.5, output: 9, cacheRead: 0.15, cacheWrite: 0 },
"google/gemini-3.5-flash-lite": {
@@ -183,6 +203,21 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
cacheWrite: 0,
},
"xai/grok-4.5": { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 },
"xai/grok-4.6": {
input: 2,
output: 6,
cacheRead: 0.5,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 200_000,
input: 4,
output: 12,
cacheRead: 1,
cacheWrite: 0,
},
],
},
}
export const TEMPORARY_PRICING: readonly TemporaryPricing[] = [
@@ -191,4 +226,9 @@ export const TEMPORARY_PRICING: readonly TemporaryPricing[] = [
expiresOn: "2026-08-31",
description: "introductory pricing",
},
{
models: ["google/gemini-3.7-flash"],
expiresOn: "2026-12-31",
description: "50% promotional pricing",
},
]