@dreb/ai 2.60.1 → 2.61.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +2 -1
  2. package/dist/models.d.ts +7 -0
  3. package/dist/models.d.ts.map +1 -1
  4. package/dist/models.generated.d.ts +68 -17
  5. package/dist/models.generated.d.ts.map +1 -1
  6. package/dist/models.generated.js +115 -64
  7. package/dist/models.generated.js.map +1 -1
  8. package/dist/models.js +11 -0
  9. package/dist/models.js.map +1 -1
  10. package/dist/providers/amazon-bedrock.d.ts.map +1 -1
  11. package/dist/providers/amazon-bedrock.js +4 -2
  12. package/dist/providers/amazon-bedrock.js.map +1 -1
  13. package/dist/providers/anthropic.d.ts.map +1 -1
  14. package/dist/providers/anthropic.js +1 -0
  15. package/dist/providers/anthropic.js.map +1 -1
  16. package/dist/providers/azure-openai-responses.d.ts +1 -1
  17. package/dist/providers/azure-openai-responses.d.ts.map +1 -1
  18. package/dist/providers/azure-openai-responses.js +2 -3
  19. package/dist/providers/azure-openai-responses.js.map +1 -1
  20. package/dist/providers/google-gemini-cli.d.ts.map +1 -1
  21. package/dist/providers/google-gemini-cli.js.map +1 -1
  22. package/dist/providers/google-vertex.d.ts.map +1 -1
  23. package/dist/providers/google-vertex.js.map +1 -1
  24. package/dist/providers/google.d.ts.map +1 -1
  25. package/dist/providers/google.js.map +1 -1
  26. package/dist/providers/openai-codex-responses.d.ts +1 -1
  27. package/dist/providers/openai-codex-responses.d.ts.map +1 -1
  28. package/dist/providers/openai-codex-responses.js +2 -3
  29. package/dist/providers/openai-codex-responses.js.map +1 -1
  30. package/dist/providers/openai-completions.d.ts +1 -1
  31. package/dist/providers/openai-completions.d.ts.map +1 -1
  32. package/dist/providers/openai-completions.js +4 -3
  33. package/dist/providers/openai-completions.js.map +1 -1
  34. package/dist/providers/openai-responses.d.ts +1 -1
  35. package/dist/providers/openai-responses.d.ts.map +1 -1
  36. package/dist/providers/openai-responses.js +2 -3
  37. package/dist/providers/openai-responses.js.map +1 -1
  38. package/dist/providers/simple-options.d.ts +2 -1
  39. package/dist/providers/simple-options.d.ts.map +1 -1
  40. package/dist/providers/simple-options.js +9 -1
  41. package/dist/providers/simple-options.js.map +1 -1
  42. package/dist/types.d.ts +1 -1
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/types.js.map +1 -1
  45. package/package.json +2 -2
package/README.md CHANGED
@@ -443,7 +443,8 @@ if (model.reasoning) {
443
443
  const response = await completeSimple(model, {
444
444
  messages: [{ role: 'user', content: 'Solve: 2x + 5 = 13' }]
445
445
  }, {
446
- reasoning: 'medium' // 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' (xhigh maps to 'max' on Claude Opus 4.6–4.x and Claude 5 families; 'high' on other Anthropic models)
446
+ reasoning: 'medium' // 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'
447
+ // Native normalized 'max' is model-aware (currently GPT-5.6). Claude's established xhigh mapping still emits provider-native 'max'.
447
448
  });
448
449
 
449
450
  // Access thinking and text blocks
package/dist/models.d.ts CHANGED
@@ -46,6 +46,13 @@ export declare function calculateCost<TApi extends Api>(model: Model<TApi>, usag
46
46
  * Qwen family with graded `reasoning_effort` tiers (low/medium/xhigh, default xhigh).
47
47
  */
48
48
  export declare function isQwen38OrLater(modelId: string): boolean;
49
+ /**
50
+ * Check if a model supports the native `max` reasoning tier.
51
+ *
52
+ * Supported today:
53
+ * - GPT-5.6 model families (Sol, Terra, Luna, and the alias)
54
+ */
55
+ export declare function supportsMax<TApi extends Api>(model: Model<TApi>): boolean;
49
56
  /**
50
57
  * Check if a model supports xhigh thinking level.
51
58
  *
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EA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AK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAO/F;AAoCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAmB3E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAGtF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,GAAG,EAC9C,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,EACjC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,CAGT","sourcesContent":["import { MODELS } from \"./models.generated.js\";\nimport type { Api, KnownProvider, Model, Usage } from \"./types.js\";\n\nconst modelRegistry: Map<string, Map<string, Model<Api>>> = new Map();\n\n// Initialize registry from MODELS on module load\nfor (const [provider, models] of Object.entries(MODELS)) {\n\tconst providerModels = new Map<string, Model<Api>>();\n\tfor (const [id, model] of Object.entries(models)) {\n\t\tproviderModels.set(id, model as Model<Api>);\n\t}\n\tmodelRegistry.set(provider, providerModels);\n}\n\ntype ModelApi<\n\tTProvider extends KnownProvider,\n\tTModelId extends keyof (typeof MODELS)[TProvider],\n> = (typeof MODELS)[TProvider][TModelId] extends { api: infer TApi } ? (TApi extends Api ? TApi : never) : never;\n\nexport function getModel<TProvider extends KnownProvider, TModelId extends keyof (typeof MODELS)[TProvider]>(\n\tprovider: TProvider,\n\tmodelId: TModelId,\n): Model<ModelApi<TProvider, TModelId>> {\n\tconst providerModels = modelRegistry.get(provider);\n\treturn providerModels?.get(modelId as string) as Model<ModelApi<TProvider, TModelId>>;\n}\n\n/**\n * Check if a model ID looks like an alias (no date suffix).\n * Aliases are preferred over dated versions when fuzzy matching.\n *\n * IDs ending with `-latest` are treated as aliases.\n * IDs ending with a date pattern (`-YYYYMMDD`) are treated as dated versions.\n */\nexport function isModelAlias(id: string): boolean {\n\tif (id.endsWith(\"-latest\")) return true;\n\treturn !/-\\d{8}$/.test(id);\n}\n\n/**\n * Find a model by fuzzy matching against the provider's registered models.\n *\n * Resolution order:\n * 1. Exact match by provider + model ID (via registry Map.get)\n * 2. Case-insensitive substring match against model ID and display name\n * 3. Among matches, prefer aliases (non-dated IDs) over dated versions\n * 4. Among ties, pick the lexicographically highest (latest) ID\n *\n * This is the same matching logic used by the CLI, subagent model resolution,\n * and interactive mode — centralised here so tests can exercise the real path.\n *\n * @example\n * findModel(\"anthropic\", \"sonnet\") // → latest claude-sonnet alias\n * findModel(\"anthropic\", \"haiku\") // → latest claude-haiku alias\n * findModel(\"openai\", \"gpt-5\") // → latest gpt-5 alias\n */\nexport function findModel(provider: string, pattern: string): Model<Api> | undefined {\n\tconst providerModels = modelRegistry.get(provider);\n\tif (!providerModels) return undefined;\n\n\t// Try exact match first\n\tconst exact = providerModels.get(pattern);\n\tif (exact) return exact;\n\n\t// Substring match (case-insensitive)\n\tconst normalizedPattern = pattern.toLowerCase();\n\tconst matches = Array.from(providerModels.values()).filter(\n\t\t(m) => m.id.toLowerCase().includes(normalizedPattern) || m.name?.toLowerCase().includes(normalizedPattern),\n\t);\n\n\tif (matches.length === 0) return undefined;\n\tif (matches.length === 1) return matches[0];\n\n\t// Multiple matches — separate into aliases and dated versions\n\tconst aliases = matches.filter((m) => isModelAlias(m.id));\n\tconst datedVersions = matches.filter((m) => !isModelAlias(m.id));\n\n\tif (aliases.length > 0) {\n\t\t// Prefer alias — if multiple, pick the lexicographically highest\n\t\taliases.sort((a, b) => b.id.localeCompare(a.id));\n\t\treturn aliases[0];\n\t}\n\n\t// All dated — prefer the latest\n\tdatedVersions.sort((a, b) => b.id.localeCompare(a.id));\n\treturn datedVersions[0];\n}\n\n/**\n * Find a model by fuzzy matching against a flat array of models.\n * Same algorithm as findModel() but operates on an arbitrary model list\n * instead of the built-in registry.\n *\n * Used by model-resolver.ts and other code that manages its own model lists.\n */\nexport function findModelInList(pattern: string, models: Model<Api>[]): Model<Api> | undefined {\n\tif (models.length === 0) return undefined;\n\n\tconst normalizedPattern = pattern.toLowerCase();\n\n\t// Exact ID match (case-insensitive)\n\tconst exactById = models.find((m) => m.id.toLowerCase() === normalizedPattern);\n\tif (exactById) return exactById;\n\n\t// Substring match (case-insensitive)\n\tconst matches = models.filter(\n\t\t(m) => m.id.toLowerCase().includes(normalizedPattern) || m.name?.toLowerCase().includes(normalizedPattern),\n\t);\n\n\tif (matches.length === 0) return undefined;\n\tif (matches.length === 1) return matches[0];\n\n\t// Multiple matches — separate into aliases and dated versions\n\tconst aliases = matches.filter((m) => isModelAlias(m.id));\n\tconst datedVersions = matches.filter((m) => !isModelAlias(m.id));\n\n\tif (aliases.length > 0) {\n\t\taliases.sort((a, b) => b.id.localeCompare(a.id));\n\t\treturn aliases[0];\n\t}\n\n\tdatedVersions.sort((a, b) => b.id.localeCompare(a.id));\n\treturn datedVersions[0];\n}\n\nexport function getProviders(): KnownProvider[] {\n\treturn Array.from(modelRegistry.keys()) as KnownProvider[];\n}\n\nexport function getModels<TProvider extends KnownProvider>(\n\tprovider: TProvider,\n): Model<ModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[] {\n\tconst models = modelRegistry.get(provider);\n\treturn models ? (Array.from(models.values()) as Model<ModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[]) : [];\n}\n\nexport function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage[\"cost\"] {\n\tusage.cost.input = (model.cost.input / 1000000) * usage.input;\n\tusage.cost.output = (model.cost.output / 1000000) * usage.output;\n\tusage.cost.cacheRead = (model.cost.cacheRead / 1000000) * usage.cacheRead;\n\tusage.cost.cacheWrite = (model.cost.cacheWrite / 1000000) * usage.cacheWrite;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n\treturn usage.cost;\n}\n\ninterface ClaudeFamilyVersion {\n\tfamily: \"opus\" | \"sonnet\";\n\tmajor: number;\n\tminor?: number;\n}\n\n/** Parse Claude family versions without mistaking long date suffixes for versions. */\nfunction claudeFamilyVersion(modelId: string): ClaudeFamilyVersion | undefined {\n\tconst match = modelId.match(/(opus|sonnet)-(\\d{1,2})(?:[.-](\\d{1,2}))?(?!\\d)/);\n\tif (!match) return undefined;\n\treturn {\n\t\tfamily: match[1] as ClaudeFamilyVersion[\"family\"],\n\t\tmajor: Number.parseInt(match[2], 10),\n\t\tminor: match[3] === undefined ? undefined : Number.parseInt(match[3], 10),\n\t};\n}\n\n/**\n * Parse Qwen family versions without mistaking parameter counts for minor versions.\n * Only a dot separates major from minor (qwen3.8-27b, Qwen-3.8); a hyphen after the\n * major version introduces the parameter size (qwen3-32b → 3.0, not 3.32). A capture\n * directly followed by a `b`-suffixed size token is a parameter count, not a version\n * (qwen-32b, Qwen-7B-Chat, deepseek-r1-distill-qwen-32b), and Qwen majors never reach\n * two digits, so only a single digit is accepted.\n */\nfunction qwenFamilyVersion(modelId: string): { major: number; minor: number } | undefined {\n\tconst match = modelId.match(/\\bqwen[\\s_-]*v?(\\d)(?:\\.(\\d+))?(?![\\d.]*b\\b)/i);\n\tif (!match) return undefined;\n\treturn {\n\t\tmajor: Number.parseInt(match[1], 10),\n\t\tminor: match[2] === undefined ? 0 : Number.parseInt(match[2], 10),\n\t};\n}\n\n/**\n * Check whether a model id belongs to Qwen 3.8 or a later Qwen generation — the first\n * Qwen family with graded `reasoning_effort` tiers (low/medium/xhigh, default xhigh).\n */\nexport function isQwen38OrLater(modelId: string): boolean {\n\tconst qwen = qwenFamilyVersion(modelId);\n\tif (!qwen) return false;\n\treturn qwen.major > 3 || (qwen.major === 3 && qwen.minor >= 8);\n}\n\n/**\n * Check if a model supports xhigh thinking level.\n *\n * Supported today:\n * - GPT-5.2 through GPT-5.6 model families\n * - Claude Opus 4.6–4.x and Claude 5 model families\n * - Kimi Code K3 (xhigh maps to its advertised \"max\" effort)\n * - Qwen 3.8+ model families (xhigh is their top native effort tier)\n */\nexport function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {\n\tif (model.provider === \"kimi-coding-oauth\" && model.id === \"k3\") return true;\n\tif (isQwen38OrLater(model.id)) return true;\n\tif (\n\t\tmodel.id.includes(\"gpt-5.2\") ||\n\t\tmodel.id.includes(\"gpt-5.3\") ||\n\t\tmodel.id.includes(\"gpt-5.4\") ||\n\t\tmodel.id.includes(\"gpt-5.5\") ||\n\t\tmodel.id.includes(\"gpt-5.6\")\n\t) {\n\t\treturn true;\n\t}\n\n\tconst claude = claudeFamilyVersion(model.id);\n\tif (!claude) return false;\n\tif (claude.family === \"opus\") {\n\t\treturn claude.major >= 5 || (claude.major === 4 && (claude.minor ?? 0) >= 6);\n\t}\n\treturn claude.major >= 5;\n}\n\n/**\n * Check if a model uses adaptive thinking (Opus/Sonnet 4.6–4.x and Claude 5\n * families), where the `thinkingDisplay` option is honored. Mirrors the\n * per-provider internal checks.\n */\nexport function supportsAdaptiveThinking<TApi extends Api>(model: Model<TApi>): boolean {\n\tconst claude = claudeFamilyVersion(model.id);\n\treturn claude != null && (claude.major >= 5 || (claude.major === 4 && (claude.minor ?? 0) >= 6));\n}\n\n/**\n * Check if two models are equal by comparing both their id and provider.\n * Returns false if either model is null or undefined.\n */\nexport function modelsAreEqual<TApi extends Api>(\n\ta: Model<TApi> | null | undefined,\n\tb: Model<TApi> | null | undefined,\n): boolean {\n\tif (!a || !b) return false;\n\treturn a.id === b.id && a.provider === b.provider;\n}\n"]}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAA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CAGhE;AAED,wBAAgB,aAAa,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAO/F;AAoCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIxD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAGzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAmB3E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAGtF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,GAAG,EAC9C,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,EACjC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,CAGT","sourcesContent":["import { MODELS } from \"./models.generated.js\";\nimport type { Api, KnownProvider, Model, Usage } from \"./types.js\";\n\nconst modelRegistry: Map<string, Map<string, Model<Api>>> = new Map();\n\n// Initialize registry from MODELS on module load\nfor (const [provider, models] of Object.entries(MODELS)) {\n\tconst providerModels = new Map<string, Model<Api>>();\n\tfor (const [id, model] of Object.entries(models)) {\n\t\tproviderModels.set(id, model as Model<Api>);\n\t}\n\tmodelRegistry.set(provider, providerModels);\n}\n\ntype ModelApi<\n\tTProvider extends KnownProvider,\n\tTModelId extends keyof (typeof MODELS)[TProvider],\n> = (typeof MODELS)[TProvider][TModelId] extends { api: infer TApi } ? (TApi extends Api ? TApi : never) : never;\n\nexport function getModel<TProvider extends KnownProvider, TModelId extends keyof (typeof MODELS)[TProvider]>(\n\tprovider: TProvider,\n\tmodelId: TModelId,\n): Model<ModelApi<TProvider, TModelId>> {\n\tconst providerModels = modelRegistry.get(provider);\n\treturn providerModels?.get(modelId as string) as Model<ModelApi<TProvider, TModelId>>;\n}\n\n/**\n * Check if a model ID looks like an alias (no date suffix).\n * Aliases are preferred over dated versions when fuzzy matching.\n *\n * IDs ending with `-latest` are treated as aliases.\n * IDs ending with a date pattern (`-YYYYMMDD`) are treated as dated versions.\n */\nexport function isModelAlias(id: string): boolean {\n\tif (id.endsWith(\"-latest\")) return true;\n\treturn !/-\\d{8}$/.test(id);\n}\n\n/**\n * Find a model by fuzzy matching against the provider's registered models.\n *\n * Resolution order:\n * 1. Exact match by provider + model ID (via registry Map.get)\n * 2. Case-insensitive substring match against model ID and display name\n * 3. Among matches, prefer aliases (non-dated IDs) over dated versions\n * 4. Among ties, pick the lexicographically highest (latest) ID\n *\n * This is the same matching logic used by the CLI, subagent model resolution,\n * and interactive mode — centralised here so tests can exercise the real path.\n *\n * @example\n * findModel(\"anthropic\", \"sonnet\") // → latest claude-sonnet alias\n * findModel(\"anthropic\", \"haiku\") // → latest claude-haiku alias\n * findModel(\"openai\", \"gpt-5\") // → latest gpt-5 alias\n */\nexport function findModel(provider: string, pattern: string): Model<Api> | undefined {\n\tconst providerModels = modelRegistry.get(provider);\n\tif (!providerModels) return undefined;\n\n\t// Try exact match first\n\tconst exact = providerModels.get(pattern);\n\tif (exact) return exact;\n\n\t// Substring match (case-insensitive)\n\tconst normalizedPattern = pattern.toLowerCase();\n\tconst matches = Array.from(providerModels.values()).filter(\n\t\t(m) => m.id.toLowerCase().includes(normalizedPattern) || m.name?.toLowerCase().includes(normalizedPattern),\n\t);\n\n\tif (matches.length === 0) return undefined;\n\tif (matches.length === 1) return matches[0];\n\n\t// Multiple matches — separate into aliases and dated versions\n\tconst aliases = matches.filter((m) => isModelAlias(m.id));\n\tconst datedVersions = matches.filter((m) => !isModelAlias(m.id));\n\n\tif (aliases.length > 0) {\n\t\t// Prefer alias — if multiple, pick the lexicographically highest\n\t\taliases.sort((a, b) => b.id.localeCompare(a.id));\n\t\treturn aliases[0];\n\t}\n\n\t// All dated — prefer the latest\n\tdatedVersions.sort((a, b) => b.id.localeCompare(a.id));\n\treturn datedVersions[0];\n}\n\n/**\n * Find a model by fuzzy matching against a flat array of models.\n * Same algorithm as findModel() but operates on an arbitrary model list\n * instead of the built-in registry.\n *\n * Used by model-resolver.ts and other code that manages its own model lists.\n */\nexport function findModelInList(pattern: string, models: Model<Api>[]): Model<Api> | undefined {\n\tif (models.length === 0) return undefined;\n\n\tconst normalizedPattern = pattern.toLowerCase();\n\n\t// Exact ID match (case-insensitive)\n\tconst exactById = models.find((m) => m.id.toLowerCase() === normalizedPattern);\n\tif (exactById) return exactById;\n\n\t// Substring match (case-insensitive)\n\tconst matches = models.filter(\n\t\t(m) => m.id.toLowerCase().includes(normalizedPattern) || m.name?.toLowerCase().includes(normalizedPattern),\n\t);\n\n\tif (matches.length === 0) return undefined;\n\tif (matches.length === 1) return matches[0];\n\n\t// Multiple matches — separate into aliases and dated versions\n\tconst aliases = matches.filter((m) => isModelAlias(m.id));\n\tconst datedVersions = matches.filter((m) => !isModelAlias(m.id));\n\n\tif (aliases.length > 0) {\n\t\taliases.sort((a, b) => b.id.localeCompare(a.id));\n\t\treturn aliases[0];\n\t}\n\n\tdatedVersions.sort((a, b) => b.id.localeCompare(a.id));\n\treturn datedVersions[0];\n}\n\nexport function getProviders(): KnownProvider[] {\n\treturn Array.from(modelRegistry.keys()) as KnownProvider[];\n}\n\nexport function getModels<TProvider extends KnownProvider>(\n\tprovider: TProvider,\n): Model<ModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[] {\n\tconst models = modelRegistry.get(provider);\n\treturn models ? (Array.from(models.values()) as Model<ModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[]) : [];\n}\n\nexport function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage[\"cost\"] {\n\tusage.cost.input = (model.cost.input / 1000000) * usage.input;\n\tusage.cost.output = (model.cost.output / 1000000) * usage.output;\n\tusage.cost.cacheRead = (model.cost.cacheRead / 1000000) * usage.cacheRead;\n\tusage.cost.cacheWrite = (model.cost.cacheWrite / 1000000) * usage.cacheWrite;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n\treturn usage.cost;\n}\n\ninterface ClaudeFamilyVersion {\n\tfamily: \"opus\" | \"sonnet\";\n\tmajor: number;\n\tminor?: number;\n}\n\n/** Parse Claude family versions without mistaking long date suffixes for versions. */\nfunction claudeFamilyVersion(modelId: string): ClaudeFamilyVersion | undefined {\n\tconst match = modelId.match(/(opus|sonnet)-(\\d{1,2})(?:[.-](\\d{1,2}))?(?!\\d)/);\n\tif (!match) return undefined;\n\treturn {\n\t\tfamily: match[1] as ClaudeFamilyVersion[\"family\"],\n\t\tmajor: Number.parseInt(match[2], 10),\n\t\tminor: match[3] === undefined ? undefined : Number.parseInt(match[3], 10),\n\t};\n}\n\n/**\n * Parse Qwen family versions without mistaking parameter counts for minor versions.\n * Only a dot separates major from minor (qwen3.8-27b, Qwen-3.8); a hyphen after the\n * major version introduces the parameter size (qwen3-32b → 3.0, not 3.32). A capture\n * directly followed by a `b`-suffixed size token is a parameter count, not a version\n * (qwen-32b, Qwen-7B-Chat, deepseek-r1-distill-qwen-32b), and Qwen majors never reach\n * two digits, so only a single digit is accepted.\n */\nfunction qwenFamilyVersion(modelId: string): { major: number; minor: number } | undefined {\n\tconst match = modelId.match(/\\bqwen[\\s_-]*v?(\\d)(?:\\.(\\d+))?(?![\\d.]*b\\b)/i);\n\tif (!match) return undefined;\n\treturn {\n\t\tmajor: Number.parseInt(match[1], 10),\n\t\tminor: match[2] === undefined ? 0 : Number.parseInt(match[2], 10),\n\t};\n}\n\n/**\n * Check whether a model id belongs to Qwen 3.8 or a later Qwen generation — the first\n * Qwen family with graded `reasoning_effort` tiers (low/medium/xhigh, default xhigh).\n */\nexport function isQwen38OrLater(modelId: string): boolean {\n\tconst qwen = qwenFamilyVersion(modelId);\n\tif (!qwen) return false;\n\treturn qwen.major > 3 || (qwen.major === 3 && qwen.minor >= 8);\n}\n\n/**\n * Check if a model supports the native `max` reasoning tier.\n *\n * Supported today:\n * - GPT-5.6 model families (Sol, Terra, Luna, and the alias)\n */\nexport function supportsMax<TApi extends Api>(model: Model<TApi>): boolean {\n\tif (/(?:^|\\/)gpt-5\\.6(?:$|[-.])/.test(model.id.toLowerCase())) return true;\n\treturn false;\n}\n\n/**\n * Check if a model supports xhigh thinking level.\n *\n * Supported today:\n * - GPT-5.2 through GPT-5.6 model families\n * - Claude Opus 4.6–4.x and Claude 5 model families\n * - Kimi Code K3 (xhigh maps to its advertised \"max\" effort)\n * - Qwen 3.8+ model families (xhigh is their top native effort tier)\n */\nexport function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {\n\tif (model.provider === \"kimi-coding-oauth\" && model.id === \"k3\") return true;\n\tif (isQwen38OrLater(model.id)) return true;\n\tif (\n\t\tmodel.id.includes(\"gpt-5.2\") ||\n\t\tmodel.id.includes(\"gpt-5.3\") ||\n\t\tmodel.id.includes(\"gpt-5.4\") ||\n\t\tmodel.id.includes(\"gpt-5.5\") ||\n\t\tmodel.id.includes(\"gpt-5.6\")\n\t) {\n\t\treturn true;\n\t}\n\n\tconst claude = claudeFamilyVersion(model.id);\n\tif (!claude) return false;\n\tif (claude.family === \"opus\") {\n\t\treturn claude.major >= 5 || (claude.major === 4 && (claude.minor ?? 0) >= 6);\n\t}\n\treturn claude.major >= 5;\n}\n\n/**\n * Check if a model uses adaptive thinking (Opus/Sonnet 4.6–4.x and Claude 5\n * families), where the `thinkingDisplay` option is honored. Mirrors the\n * per-provider internal checks.\n */\nexport function supportsAdaptiveThinking<TApi extends Api>(model: Model<TApi>): boolean {\n\tconst claude = claudeFamilyVersion(model.id);\n\treturn claude != null && (claude.major >= 5 || (claude.major === 4 && (claude.minor ?? 0) >= 6));\n}\n\n/**\n * Check if two models are equal by comparing both their id and provider.\n * Returns false if either model is null or undefined.\n */\nexport function modelsAreEqual<TApi extends Api>(\n\ta: Model<TApi> | null | undefined,\n\tb: Model<TApi> | null | undefined,\n): boolean {\n\tif (!a || !b) return false;\n\treturn a.id === b.id && a.provider === b.provider;\n}\n"]}
@@ -7984,23 +7984,6 @@ export declare const MODELS: {
7984
7984
  contextWindow: number;
7985
7985
  maxTokens: number;
7986
7986
  };
7987
- readonly "deepseek-v4-flash-free": {
7988
- id: string;
7989
- name: string;
7990
- api: "openai-completions";
7991
- provider: string;
7992
- baseUrl: string;
7993
- reasoning: true;
7994
- input: "text"[];
7995
- cost: {
7996
- input: number;
7997
- output: number;
7998
- cacheRead: number;
7999
- cacheWrite: number;
8000
- };
8001
- contextWindow: number;
8002
- maxTokens: number;
8003
- };
8004
7987
  readonly "deepseek-v4-pro": {
8005
7988
  id: string;
8006
7989
  name: string;
@@ -8836,6 +8819,23 @@ export declare const MODELS: {
8836
8819
  contextWindow: number;
8837
8820
  maxTokens: number;
8838
8821
  };
8822
+ readonly "deepseek-v4-flash-vision-exp": {
8823
+ id: string;
8824
+ name: string;
8825
+ api: "openai-completions";
8826
+ provider: string;
8827
+ baseUrl: string;
8828
+ reasoning: true;
8829
+ input: ("image" | "text")[];
8830
+ cost: {
8831
+ input: number;
8832
+ output: number;
8833
+ cacheRead: number;
8834
+ cacheWrite: number;
8835
+ };
8836
+ contextWindow: number;
8837
+ maxTokens: number;
8838
+ };
8839
8839
  readonly "deepseek-v4-pro": {
8840
8840
  id: string;
8841
8841
  name: string;
@@ -9091,6 +9091,23 @@ export declare const MODELS: {
9091
9091
  contextWindow: number;
9092
9092
  maxTokens: number;
9093
9093
  };
9094
+ readonly "ox-alpha-free": {
9095
+ id: string;
9096
+ name: string;
9097
+ api: "openai-completions";
9098
+ provider: string;
9099
+ baseUrl: string;
9100
+ reasoning: true;
9101
+ input: ("image" | "text")[];
9102
+ cost: {
9103
+ input: number;
9104
+ output: number;
9105
+ cacheRead: number;
9106
+ cacheWrite: number;
9107
+ };
9108
+ contextWindow: number;
9109
+ maxTokens: number;
9110
+ };
9094
9111
  readonly "qwen3.6-plus": {
9095
9112
  id: string;
9096
9113
  name: string;
@@ -10147,6 +10164,23 @@ export declare const MODELS: {
10147
10164
  contextWindow: number;
10148
10165
  maxTokens: number;
10149
10166
  };
10167
+ readonly "deepseek/deepseek-v4-flash-vision-exp": {
10168
+ id: string;
10169
+ name: string;
10170
+ api: "openai-completions";
10171
+ provider: string;
10172
+ baseUrl: string;
10173
+ reasoning: true;
10174
+ input: ("image" | "text")[];
10175
+ cost: {
10176
+ input: number;
10177
+ output: number;
10178
+ cacheRead: number;
10179
+ cacheWrite: number;
10180
+ };
10181
+ contextWindow: number;
10182
+ maxTokens: number;
10183
+ };
10150
10184
  readonly "deepseek/deepseek-v4-pro": {
10151
10185
  id: string;
10152
10186
  name: string;
@@ -16133,6 +16167,23 @@ export declare const MODELS: {
16133
16167
  contextWindow: number;
16134
16168
  maxTokens: number;
16135
16169
  };
16170
+ readonly "deepseek/deepseek-v4-flash-vision-exp": {
16171
+ id: string;
16172
+ name: string;
16173
+ api: "anthropic-messages";
16174
+ provider: string;
16175
+ baseUrl: string;
16176
+ reasoning: true;
16177
+ input: ("image" | "text")[];
16178
+ cost: {
16179
+ input: number;
16180
+ output: number;
16181
+ cacheRead: number;
16182
+ cacheWrite: number;
16183
+ };
16184
+ contextWindow: number;
16185
+ maxTokens: number;
16186
+ };
16136
16187
  readonly "deepseek/deepseek-v4-pro": {
16137
16188
  id: string;
16138
16189
  name: string;