@dreb/ai 2.45.1 → 2.45.2

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.
package/README.md CHANGED
@@ -443,7 +443,7 @@ 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 Opus 4.6+, 'high' on other Anthropic models)
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)
447
447
  });
448
448
 
449
449
  // Access thinking and text blocks
@@ -511,8 +511,8 @@ for await (const event of s) {
511
511
 
512
512
  ### Controlling Thinking Display (Anthropic adaptive models)
513
513
 
514
- Adaptive-thinking Claude models (Opus 4.6+, Sonnet 4.6+) support a `thinkingDisplay`
515
- option on `streamSimple`/`completeSimple`:
514
+ Adaptive-thinking Claude models (Opus and Sonnet 4.6–4.x, plus Claude 5 families)
515
+ support a `thinkingDisplay` option on `streamSimple`/`completeSimple`:
516
516
 
517
517
  ```typescript
518
518
  const s = streamSimple(model, context, {
@@ -1067,7 +1067,6 @@ The quickest way to authenticate:
1067
1067
 
1068
1068
  ```bash
1069
1069
  npx @dreb/ai login # interactive provider selection
1070
- npx @dreb/ai login # interactive provider selection
1071
1070
  npx @dreb/ai list # list available providers
1072
1071
  ```
1073
1072
 
package/dist/models.d.ts CHANGED
@@ -46,13 +46,14 @@ export declare function calculateCost<TApi extends Api>(model: Model<TApi>, usag
46
46
  *
47
47
  * Supported today:
48
48
  * - GPT-5.2 through GPT-5.6 model families
49
- * - Opus 4.6+ models (xhigh maps to adaptive effort "max" on Anthropic-compatible providers)
49
+ * - Claude Opus 4.6–4.x and Claude 5 model families
50
50
  * - Kimi Code K3 (xhigh maps to its advertised "max" effort)
51
51
  */
52
52
  export declare function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean;
53
53
  /**
54
- * Check if a model uses adaptive thinking (Opus 4.6+, Sonnet 4.6+), where the
55
- * `thinkingDisplay` option is honored. Mirrors the per-provider internal checks.
54
+ * Check if a model uses adaptive thinking (Opus/Sonnet 4.64.x and Claude 5
55
+ * families), where the `thinkingDisplay` option is honored. Mirrors the
56
+ * per-provider internal checks.
56
57
  */
57
58
  export declare function supportsAdaptiveThinking<TApi extends Api>(model: Model<TApi>): boolean;
58
59
  /**
@@ -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,EAAE,MAAM,YAAY,CAAC;AAanE,KAAK,QAAQ,CACZ,SAAS,SAAS,aAAa,EAC/B,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,IAC9C,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,CAAC,IAAI,SAAS,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEjH,wBAAgB,QAAQ,CAAC,SAAS,SAAS,aAAa,EAAE,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,EAC1G,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,GACf,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAGhD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CA8BnF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CA4B7F;AAED,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAE9C;AAED,wBAAgB,SAAS,CAAC,SAAS,SAAS,aAAa,EACxD,QAAQ,EAAE,SAAS,GACjB,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,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;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAoB3E;AAED;;;GAGG;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\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 * - Opus 4.6+ models (xhigh maps to adaptive effort \"max\" on Anthropic-compatible providers)\n * - Kimi Code K3 (xhigh maps to its advertised \"max\" effort)\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 (\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\t// Opus 4.6+ supports xhigh (adaptive effort \"max\").\n\t// Match any opus-4-N or opus-4.N where N >= 6 (1-2 digit minor version, not date suffixes).\n\tconst opusMatch = model.id.match(/opus-4[.-](\\d{1,2})(?!\\d)/);\n\tif (opusMatch && Number.parseInt(opusMatch[1], 10) >= 6) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n/**\n * Check if a model uses adaptive thinking (Opus 4.6+, Sonnet 4.6+), where the\n * `thinkingDisplay` option is honored. Mirrors the per-provider internal checks.\n */\nexport function supportsAdaptiveThinking<TApi extends Api>(model: Model<TApi>): boolean {\n\tconst m = model.id.match(/(opus|sonnet)-4[.-](\\d{1,2})(?!\\d)/);\n\treturn m != null && Number.parseInt(m[2], 10) >= 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,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAanE,KAAK,QAAQ,CACZ,SAAS,SAAS,aAAa,EAC/B,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,IAC9C,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,CAAC,IAAI,SAAS,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEjH,wBAAgB,QAAQ,CAAC,SAAS,SAAS,aAAa,EAAE,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,EAC1G,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,GACf,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAGhD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CA8BnF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CA4B7F;AAED,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAE9C;AAED,wBAAgB,SAAS,CAAC,SAAS,SAAS,aAAa,EACxD,QAAQ,EAAE,SAAS,GACjB,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,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;AAmBD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAkB3E;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 * 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 */\nexport function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {\n\tif (model.provider === \"kimi-coding-oauth\" && model.id === \"k3\") 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"]}
@@ -187,6 +187,23 @@ export declare const MODELS: {
187
187
  contextWindow: number;
188
188
  maxTokens: number;
189
189
  };
190
+ readonly "anthropic.claude-opus-5": {
191
+ id: string;
192
+ name: string;
193
+ api: "bedrock-converse-stream";
194
+ provider: string;
195
+ baseUrl: string;
196
+ reasoning: true;
197
+ input: ("image" | "text")[];
198
+ cost: {
199
+ input: number;
200
+ output: number;
201
+ cacheRead: number;
202
+ cacheWrite: number;
203
+ };
204
+ contextWindow: number;
205
+ maxTokens: number;
206
+ };
190
207
  readonly "anthropic.claude-sonnet-4-5-20250929-v1:0": {
191
208
  id: string;
192
209
  name: string;
@@ -289,6 +306,23 @@ export declare const MODELS: {
289
306
  contextWindow: number;
290
307
  maxTokens: number;
291
308
  };
309
+ readonly "au.anthropic.claude-opus-5": {
310
+ id: string;
311
+ name: string;
312
+ api: "bedrock-converse-stream";
313
+ provider: string;
314
+ baseUrl: string;
315
+ reasoning: true;
316
+ input: ("image" | "text")[];
317
+ cost: {
318
+ input: number;
319
+ output: number;
320
+ cacheRead: number;
321
+ cacheWrite: number;
322
+ };
323
+ contextWindow: number;
324
+ maxTokens: number;
325
+ };
292
326
  readonly "au.anthropic.claude-sonnet-4-5-20250929-v1:0": {
293
327
  id: string;
294
328
  name: string;
@@ -493,6 +527,23 @@ export declare const MODELS: {
493
527
  contextWindow: number;
494
528
  maxTokens: number;
495
529
  };
530
+ readonly "eu.anthropic.claude-opus-5": {
531
+ id: string;
532
+ name: string;
533
+ api: "bedrock-converse-stream";
534
+ provider: string;
535
+ baseUrl: string;
536
+ reasoning: true;
537
+ input: ("image" | "text")[];
538
+ cost: {
539
+ input: number;
540
+ output: number;
541
+ cacheRead: number;
542
+ cacheWrite: number;
543
+ };
544
+ contextWindow: number;
545
+ maxTokens: number;
546
+ };
496
547
  readonly "eu.anthropic.claude-sonnet-4-5-20250929-v1:0": {
497
548
  id: string;
498
549
  name: string;
@@ -646,6 +697,23 @@ export declare const MODELS: {
646
697
  contextWindow: number;
647
698
  maxTokens: number;
648
699
  };
700
+ readonly "global.anthropic.claude-opus-5": {
701
+ id: string;
702
+ name: string;
703
+ api: "bedrock-converse-stream";
704
+ provider: string;
705
+ baseUrl: string;
706
+ reasoning: true;
707
+ input: ("image" | "text")[];
708
+ cost: {
709
+ input: number;
710
+ output: number;
711
+ cacheRead: number;
712
+ cacheWrite: number;
713
+ };
714
+ contextWindow: number;
715
+ maxTokens: number;
716
+ };
649
717
  readonly "global.anthropic.claude-sonnet-4-5-20250929-v1:0": {
650
718
  id: string;
651
719
  name: string;
@@ -782,6 +850,23 @@ export declare const MODELS: {
782
850
  contextWindow: number;
783
851
  maxTokens: number;
784
852
  };
853
+ readonly "jp.anthropic.claude-opus-5": {
854
+ id: string;
855
+ name: string;
856
+ api: "bedrock-converse-stream";
857
+ provider: string;
858
+ baseUrl: string;
859
+ reasoning: true;
860
+ input: ("image" | "text")[];
861
+ cost: {
862
+ input: number;
863
+ output: number;
864
+ cacheRead: number;
865
+ cacheWrite: number;
866
+ };
867
+ contextWindow: number;
868
+ maxTokens: number;
869
+ };
785
870
  readonly "jp.anthropic.claude-sonnet-4-5-20250929-v1:0": {
786
871
  id: string;
787
872
  name: string;
@@ -1649,6 +1734,23 @@ export declare const MODELS: {
1649
1734
  contextWindow: number;
1650
1735
  maxTokens: number;
1651
1736
  };
1737
+ readonly "us.anthropic.claude-opus-5": {
1738
+ id: string;
1739
+ name: string;
1740
+ api: "bedrock-converse-stream";
1741
+ provider: string;
1742
+ baseUrl: string;
1743
+ reasoning: true;
1744
+ input: ("image" | "text")[];
1745
+ cost: {
1746
+ input: number;
1747
+ output: number;
1748
+ cacheRead: number;
1749
+ cacheWrite: number;
1750
+ };
1751
+ contextWindow: number;
1752
+ maxTokens: number;
1753
+ };
1652
1754
  readonly "us.anthropic.claude-sonnet-4-5-20250929-v1:0": {
1653
1755
  id: string;
1654
1756
  name: string;
@@ -2025,6 +2127,23 @@ export declare const MODELS: {
2025
2127
  contextWindow: number;
2026
2128
  maxTokens: number;
2027
2129
  };
2130
+ readonly "claude-opus-5": {
2131
+ id: string;
2132
+ name: string;
2133
+ api: "anthropic-messages";
2134
+ provider: string;
2135
+ baseUrl: string;
2136
+ reasoning: true;
2137
+ input: ("image" | "text")[];
2138
+ cost: {
2139
+ input: number;
2140
+ output: number;
2141
+ cacheRead: number;
2142
+ cacheWrite: number;
2143
+ };
2144
+ contextWindow: number;
2145
+ maxTokens: number;
2146
+ };
2028
2147
  readonly "claude-sonnet-4-5": {
2029
2148
  id: string;
2030
2149
  name: string;
@@ -2299,23 +2418,6 @@ export declare const MODELS: {
2299
2418
  contextWindow: number;
2300
2419
  maxTokens: number;
2301
2420
  };
2302
- readonly "gpt-5-codex": {
2303
- id: string;
2304
- name: string;
2305
- api: "azure-openai-responses";
2306
- provider: string;
2307
- baseUrl: string;
2308
- reasoning: true;
2309
- input: ("image" | "text")[];
2310
- cost: {
2311
- input: number;
2312
- output: number;
2313
- cacheRead: number;
2314
- cacheWrite: number;
2315
- };
2316
- contextWindow: number;
2317
- maxTokens: number;
2318
- };
2319
2421
  readonly "gpt-5-mini": {
2320
2422
  id: string;
2321
2423
  name: string;
@@ -2384,23 +2486,6 @@ export declare const MODELS: {
2384
2486
  contextWindow: number;
2385
2487
  maxTokens: number;
2386
2488
  };
2387
- readonly "gpt-5.1-chat-latest": {
2388
- id: string;
2389
- name: string;
2390
- api: "azure-openai-responses";
2391
- provider: string;
2392
- baseUrl: string;
2393
- reasoning: true;
2394
- input: ("image" | "text")[];
2395
- cost: {
2396
- input: number;
2397
- output: number;
2398
- cacheRead: number;
2399
- cacheWrite: number;
2400
- };
2401
- contextWindow: number;
2402
- maxTokens: number;
2403
- };
2404
2489
  readonly "gpt-5.1-codex": {
2405
2490
  id: string;
2406
2491
  name: string;
@@ -2435,23 +2520,6 @@ export declare const MODELS: {
2435
2520
  contextWindow: number;
2436
2521
  maxTokens: number;
2437
2522
  };
2438
- readonly "gpt-5.1-codex-mini": {
2439
- id: string;
2440
- name: string;
2441
- api: "azure-openai-responses";
2442
- provider: string;
2443
- baseUrl: string;
2444
- reasoning: true;
2445
- input: ("image" | "text")[];
2446
- cost: {
2447
- input: number;
2448
- output: number;
2449
- cacheRead: number;
2450
- cacheWrite: number;
2451
- };
2452
- contextWindow: number;
2453
- maxTokens: number;
2454
- };
2455
2523
  readonly "gpt-5.2": {
2456
2524
  id: string;
2457
2525
  name: string;
@@ -2486,23 +2554,6 @@ export declare const MODELS: {
2486
2554
  contextWindow: number;
2487
2555
  maxTokens: number;
2488
2556
  };
2489
- readonly "gpt-5.2-codex": {
2490
- id: string;
2491
- name: string;
2492
- api: "azure-openai-responses";
2493
- provider: string;
2494
- baseUrl: string;
2495
- reasoning: true;
2496
- input: ("image" | "text")[];
2497
- cost: {
2498
- input: number;
2499
- output: number;
2500
- cacheRead: number;
2501
- cacheWrite: number;
2502
- };
2503
- contextWindow: number;
2504
- maxTokens: number;
2505
- };
2506
2557
  readonly "gpt-5.2-pro": {
2507
2558
  id: string;
2508
2559
  name: string;
@@ -2809,23 +2860,6 @@ export declare const MODELS: {
2809
2860
  contextWindow: number;
2810
2861
  maxTokens: number;
2811
2862
  };
2812
- readonly "o3-deep-research": {
2813
- id: string;
2814
- name: string;
2815
- api: "azure-openai-responses";
2816
- provider: string;
2817
- baseUrl: string;
2818
- reasoning: true;
2819
- input: ("image" | "text")[];
2820
- cost: {
2821
- input: number;
2822
- output: number;
2823
- cacheRead: number;
2824
- cacheWrite: number;
2825
- };
2826
- contextWindow: number;
2827
- maxTokens: number;
2828
- };
2829
2863
  readonly "o3-mini": {
2830
2864
  id: string;
2831
2865
  name: string;
@@ -2877,23 +2911,6 @@ export declare const MODELS: {
2877
2911
  contextWindow: number;
2878
2912
  maxTokens: number;
2879
2913
  };
2880
- readonly "o4-mini-deep-research": {
2881
- id: string;
2882
- name: string;
2883
- api: "azure-openai-responses";
2884
- provider: string;
2885
- baseUrl: string;
2886
- reasoning: true;
2887
- input: ("image" | "text")[];
2888
- cost: {
2889
- input: number;
2890
- output: number;
2891
- cacheRead: number;
2892
- cacheWrite: number;
2893
- };
2894
- contextWindow: number;
2895
- maxTokens: number;
2896
- };
2897
2914
  };
2898
2915
  readonly cerebras: {
2899
2916
  readonly "gemma-4-31b": {
@@ -3075,6 +3092,34 @@ export declare const MODELS: {
3075
3092
  contextWindow: number;
3076
3093
  maxTokens: number;
3077
3094
  };
3095
+ readonly "claude-opus-5": {
3096
+ id: string;
3097
+ name: string;
3098
+ api: "openai-completions";
3099
+ provider: string;
3100
+ baseUrl: string;
3101
+ headers: {
3102
+ "User-Agent": string;
3103
+ "Editor-Version": string;
3104
+ "Editor-Plugin-Version": string;
3105
+ "Copilot-Integration-Id": string;
3106
+ };
3107
+ compat: {
3108
+ supportsStore: false;
3109
+ supportsDeveloperRole: false;
3110
+ supportsReasoningEffort: false;
3111
+ };
3112
+ reasoning: true;
3113
+ input: ("image" | "text")[];
3114
+ cost: {
3115
+ input: number;
3116
+ output: number;
3117
+ cacheRead: number;
3118
+ cacheWrite: number;
3119
+ };
3120
+ contextWindow: number;
3121
+ maxTokens: number;
3122
+ };
3078
3123
  readonly "claude-sonnet-4": {
3079
3124
  id: string;
3080
3125
  name: string;
@@ -6582,23 +6627,6 @@ export declare const MODELS: {
6582
6627
  contextWindow: number;
6583
6628
  maxTokens: number;
6584
6629
  };
6585
- readonly "gpt-5-codex": {
6586
- id: string;
6587
- name: string;
6588
- api: "openai-responses";
6589
- provider: string;
6590
- baseUrl: string;
6591
- reasoning: true;
6592
- input: ("image" | "text")[];
6593
- cost: {
6594
- input: number;
6595
- output: number;
6596
- cacheRead: number;
6597
- cacheWrite: number;
6598
- };
6599
- contextWindow: number;
6600
- maxTokens: number;
6601
- };
6602
6630
  readonly "gpt-5-mini": {
6603
6631
  id: string;
6604
6632
  name: string;
@@ -6667,23 +6695,6 @@ export declare const MODELS: {
6667
6695
  contextWindow: number;
6668
6696
  maxTokens: number;
6669
6697
  };
6670
- readonly "gpt-5.1-chat-latest": {
6671
- id: string;
6672
- name: string;
6673
- api: "openai-responses";
6674
- provider: string;
6675
- baseUrl: string;
6676
- reasoning: true;
6677
- input: ("image" | "text")[];
6678
- cost: {
6679
- input: number;
6680
- output: number;
6681
- cacheRead: number;
6682
- cacheWrite: number;
6683
- };
6684
- contextWindow: number;
6685
- maxTokens: number;
6686
- };
6687
6698
  readonly "gpt-5.1-codex": {
6688
6699
  id: string;
6689
6700
  name: string;
@@ -6718,23 +6729,6 @@ export declare const MODELS: {
6718
6729
  contextWindow: number;
6719
6730
  maxTokens: number;
6720
6731
  };
6721
- readonly "gpt-5.1-codex-mini": {
6722
- id: string;
6723
- name: string;
6724
- api: "openai-responses";
6725
- provider: string;
6726
- baseUrl: string;
6727
- reasoning: true;
6728
- input: ("image" | "text")[];
6729
- cost: {
6730
- input: number;
6731
- output: number;
6732
- cacheRead: number;
6733
- cacheWrite: number;
6734
- };
6735
- contextWindow: number;
6736
- maxTokens: number;
6737
- };
6738
6732
  readonly "gpt-5.2": {
6739
6733
  id: string;
6740
6734
  name: string;
@@ -6769,23 +6763,6 @@ export declare const MODELS: {
6769
6763
  contextWindow: number;
6770
6764
  maxTokens: number;
6771
6765
  };
6772
- readonly "gpt-5.2-codex": {
6773
- id: string;
6774
- name: string;
6775
- api: "openai-responses";
6776
- provider: string;
6777
- baseUrl: string;
6778
- reasoning: true;
6779
- input: ("image" | "text")[];
6780
- cost: {
6781
- input: number;
6782
- output: number;
6783
- cacheRead: number;
6784
- cacheWrite: number;
6785
- };
6786
- contextWindow: number;
6787
- maxTokens: number;
6788
- };
6789
6766
  readonly "gpt-5.2-pro": {
6790
6767
  id: string;
6791
6768
  name: string;
@@ -7092,23 +7069,6 @@ export declare const MODELS: {
7092
7069
  contextWindow: number;
7093
7070
  maxTokens: number;
7094
7071
  };
7095
- readonly "o3-deep-research": {
7096
- id: string;
7097
- name: string;
7098
- api: "openai-responses";
7099
- provider: string;
7100
- baseUrl: string;
7101
- reasoning: true;
7102
- input: ("image" | "text")[];
7103
- cost: {
7104
- input: number;
7105
- output: number;
7106
- cacheRead: number;
7107
- cacheWrite: number;
7108
- };
7109
- contextWindow: number;
7110
- maxTokens: number;
7111
- };
7112
7072
  readonly "o3-mini": {
7113
7073
  id: string;
7114
7074
  name: string;
@@ -7160,23 +7120,6 @@ export declare const MODELS: {
7160
7120
  contextWindow: number;
7161
7121
  maxTokens: number;
7162
7122
  };
7163
- readonly "o4-mini-deep-research": {
7164
- id: string;
7165
- name: string;
7166
- api: "openai-responses";
7167
- provider: string;
7168
- baseUrl: string;
7169
- reasoning: true;
7170
- input: ("image" | "text")[];
7171
- cost: {
7172
- input: number;
7173
- output: number;
7174
- cacheRead: number;
7175
- cacheWrite: number;
7176
- };
7177
- contextWindow: number;
7178
- maxTokens: number;
7179
- };
7180
7123
  };
7181
7124
  readonly "openai-codex": {
7182
7125
  readonly "gpt-5.1": {
@@ -7504,6 +7447,23 @@ export declare const MODELS: {
7504
7447
  contextWindow: number;
7505
7448
  maxTokens: number;
7506
7449
  };
7450
+ readonly "claude-opus-5": {
7451
+ id: string;
7452
+ name: string;
7453
+ api: "anthropic-messages";
7454
+ provider: string;
7455
+ baseUrl: string;
7456
+ reasoning: true;
7457
+ input: ("image" | "text")[];
7458
+ cost: {
7459
+ input: number;
7460
+ output: number;
7461
+ cacheRead: number;
7462
+ cacheWrite: number;
7463
+ };
7464
+ contextWindow: number;
7465
+ maxTokens: number;
7466
+ };
7507
7467
  readonly "claude-sonnet-4": {
7508
7468
  id: string;
7509
7469
  name: string;
@@ -8953,6 +8913,40 @@ export declare const MODELS: {
8953
8913
  contextWindow: number;
8954
8914
  maxTokens: number;
8955
8915
  };
8916
+ readonly "anthropic/claude-opus-5": {
8917
+ id: string;
8918
+ name: string;
8919
+ api: "openai-completions";
8920
+ provider: string;
8921
+ baseUrl: string;
8922
+ reasoning: true;
8923
+ input: ("image" | "text")[];
8924
+ cost: {
8925
+ input: number;
8926
+ output: number;
8927
+ cacheRead: number;
8928
+ cacheWrite: number;
8929
+ };
8930
+ contextWindow: number;
8931
+ maxTokens: number;
8932
+ };
8933
+ readonly "anthropic/claude-opus-5-fast": {
8934
+ id: string;
8935
+ name: string;
8936
+ api: "openai-completions";
8937
+ provider: string;
8938
+ baseUrl: string;
8939
+ reasoning: true;
8940
+ input: ("image" | "text")[];
8941
+ cost: {
8942
+ input: number;
8943
+ output: number;
8944
+ cacheRead: number;
8945
+ cacheWrite: number;
8946
+ };
8947
+ contextWindow: number;
8948
+ maxTokens: number;
8949
+ };
8956
8950
  readonly "anthropic/claude-sonnet-4": {
8957
8951
  id: string;
8958
8952
  name: string;
@@ -13919,6 +13913,40 @@ export declare const MODELS: {
13919
13913
  contextWindow: number;
13920
13914
  maxTokens: number;
13921
13915
  };
13916
+ readonly "anthropic/claude-opus-5": {
13917
+ id: string;
13918
+ name: string;
13919
+ api: "anthropic-messages";
13920
+ provider: string;
13921
+ baseUrl: string;
13922
+ reasoning: true;
13923
+ input: ("image" | "text")[];
13924
+ cost: {
13925
+ input: number;
13926
+ output: number;
13927
+ cacheRead: number;
13928
+ cacheWrite: number;
13929
+ };
13930
+ contextWindow: number;
13931
+ maxTokens: number;
13932
+ };
13933
+ readonly "anthropic/claude-opus-5-fast": {
13934
+ id: string;
13935
+ name: string;
13936
+ api: "anthropic-messages";
13937
+ provider: string;
13938
+ baseUrl: string;
13939
+ reasoning: true;
13940
+ input: ("image" | "text")[];
13941
+ cost: {
13942
+ input: number;
13943
+ output: number;
13944
+ cacheRead: number;
13945
+ cacheWrite: number;
13946
+ };
13947
+ contextWindow: number;
13948
+ maxTokens: number;
13949
+ };
13922
13950
  readonly "anthropic/claude-sonnet-4": {
13923
13951
  id: string;
13924
13952
  name: string;