Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Astra9// File : Packages/AstraProviders/Sources/CuratedCatalog.swift10// Module : Packages11// Repository : https://git.spboucher.ai/orix-astra12// Created : 2026-11-2113// Last Modified : 2026-11-2114//15// =============================================================================16// AUTHOR & PROFESSIONAL AFFILIATION17// =============================================================================18//19// Author : Simon-Pierre Boucher20// Position : Professor of Finance21// Institution : Université du Québec en Outaouais (UQO)22// Department : Département des sciences administratives23// Organization : SP Boucher24//25// Website : https://spboucher.ai26// Git : https://git.spboucher.ai27//28// =============================================================================29// OFFICIAL CONTACT DIRECTORY30// =============================================================================31//32// General : info@spboucher.ai33// Professional : contact@spboucher.ai34// Direct : simon@spboucher.ai35// Research : research@spboucher.ai36// Development : dev@spboucher.ai37// Support : support@spboucher.ai38// Security/Admin : admin@spboucher.ai39// Notifications : notifications@spboucher.ai40//41// Preferred Contact: support@spboucher.ai42//43// =============================================================================44// COPYRIGHT & INTELLECTUAL PROPERTY45// =============================================================================46//47// Copyright (c) 202648// Simon-Pierre Boucher49//50// All rights reserved where applicable.51//52// This file is governed by the applicable project license,53// copyright notices, institutional agreements and relevant law.54//55// Unless expressly authorized by the applicable license or56// rights holder, copying, redistribution, sublicensing,57// publication and commercial exploitation are not permitted.58//59// Existing third-party rights and notices remain unaffected.60//61// =============================================================================62// CONFIDENTIALITY & SECURITY63// =============================================================================64//65// Classification : Public66// Distribution : Public repository; use is governed by the project license67// Security Contact : admin@spboucher.ai68//69// Access to this source does not independently grant permission70// to redistribute or disclose confidential materials.71//72// Do not embed credentials, private keys, access tokens,73// certificates or confidential personal information.74//75// =============================================================================76// LICENSE & MAINTENANCE77// =============================================================================78//79// License : Proprietary, all rights reserved (see license file)80// License File : LICENSE81// Maintainer : Simon-Pierre Boucher82// Technical Contact: dev@spboucher.ai83//84// =============================================================================85// END OF SP BOUCHER SOURCE HEADER86// =============================================================================8788// Curated model metadata. Verified on 2026-11-21.89//90// Every figure below was read from the provider's own documentation or returned by the provider's own API on that day.91// Nothing here is recalled from memory; a value that could not be verified is nil and the UI shows no badge for it.92//93// Sources94// OpenAI prices https://developers.openai.com/api/docs/pricing (Standard tier, short context, USD / 1M tokens)95// limits, modality https://developers.openai.com/api/docs/models (the four featured models only)96// reasoning rules https://developers.openai.com/api/docs/guides/reasoning, .../guides/latest-model97// parameter rules live API responses on 2026-11-21 (400 "Unsupported parameter: 'temperature'" on gpt-6-luna, gpt-5-nano;98// 400 "'reasoning.effort' is not supported" on gpt-4.1-mini)99// Anthropic prices https://platform.claude.com/docs/en/about-claude/pricing (base input, 5-minute cache write, cache hit, output)100// limits, features GET https://api.anthropic.com/v1/models (max_input_tokens, max_tokens, capabilities), read live101// thinking rules https://platform.claude.com/docs/en/build-with-claude/thinking and the capabilities.thinking tree of the Models API102// cache minimums https://platform.claude.com/docs/en/build-with-claude/prompt-caching103// Google prices https://aistudio.google.com/docs/pricing (ai.google.dev/gemini-api/docs/pricing redirects there), Standard paid tier104// limits come from GET /v1beta/models at run time, not from this file105// xAI nothing curated: GET https://api.x.ai/v1/language-models returns modalities, prices and reasoning efforts itself106// OpenRouter nothing curated: GET https://openrouter.ai/api/v1/models returns everything107//108// Added on 2026-11-22 (each entry carries its own date):109// DeepSeek prices, features https://api-docs.deepseek.com/quick_start/pricing (tool calls, cache-hit price; peak-hour prices)110// limits, modality GET https://api.deepseek.com/models (context_window, max_output_tokens, input_modalities), read live111// Moonshot tool calling https://platform.kimi.ai/docs/api/chat documents `tools` for the API; exercised live on each listed id.112// limits, modality come from GET https://api.moonshot.ai/v1/models; the pricing page rendered no figures, so no price113// Mistral nothing curated: GET https://api.mistral.ai/v1/models returns context and capabilities; no per-model price was readable114// Cerebras nothing curated: GET https://api.cerebras.ai/public/v1/models returns limits, capabilities and prices115// DeepInfra nothing curated: GET https://api.deepinfra.com/v1/openai/models returns limits, tags and prices116//117// Cross-check: every OpenAI and Google price below was compared with the price OpenRouter lists for the same model on 2026-11-21.118// gemini-3.8-flash disagreed (documentation 0.75 / 3.75, OpenRouter 0.825 / 4.125), so it carries no price.119//120// Capability claims are deliberately narrow: a capability is listed only where the provider documents it for that model121// or its own API reports it. Models outside these tables are listed with `.text` only and `source: .providerAPI`.122123import AstraCore124import Foundation125126public enum CuratedCatalog {127 public static let verifiedOn = "2026-11-21"128129 // MARK: OpenAI130131 struct OpenAIEntry: Sendable {132 var id: String133 var displayName: String134 var contextLength: Int?135 var maxOutputTokens: Int?136 var capabilities: Set<Capability>137 var input: Double138 var cachedInput: Double?139 var cacheWrite: Double?140 var output: Double141 /// Whether `temperature` / `top_p` are accepted. Reasoning-family models reject them with a 400.142 var acceptsSampling: Bool143 /// Reasoning efforts the model accepts; empty for a model without reasoning.144 var reasoningEfforts: [String]145 /// GPT-6.2 appends top-level `instructions` after `input`; a leading `developer` message keeps the system text cacheable.146 var systemAsDeveloperMessage: Bool = false147 }148149 static let openAIPricingURL = "https://developers.openai.com/api/docs/pricing"150 static let openAIModelsURL = "https://developers.openai.com/api/docs/models"151 private static let flagship: Set<Capability> = [.text, .vision, .tools, .reasoning, .promptCaching]152 private static let allEfforts = ["none", "low", "medium", "high", "xhigh", "max"]153 private static let noNone = ["low", "medium", "high", "xhigh", "max"]154 /// Efforts of older reasoning models are not documented per model here; the adapter sends low / medium / high and falls back.155 private static let basicEfforts = ["low", "medium", "high"]156157 static let openAI: [OpenAIEntry] = [158 .init(id: "gpt-6.2-astra", displayName: "GPT-6.2 Astra", contextLength: 1_050_000, maxOutputTokens: 128_000, capabilities: flagship,159 input: 8, cachedInput: 0.40, cacheWrite: 10, output: 40, acceptsSampling: false, reasoningEfforts: noNone, systemAsDeveloperMessage: true),160 .init(id: "gpt-6.2-sol", displayName: "GPT-6.2 Sol", contextLength: 1_050_000, maxOutputTokens: 128_000, capabilities: flagship,161 input: 2, cachedInput: 0.10, cacheWrite: 2.50, output: 10, acceptsSampling: false, reasoningEfforts: noNone, systemAsDeveloperMessage: true),162 .init(id: "gpt-6.1-terra", displayName: "GPT-6.1 Terra", contextLength: 1_050_000, maxOutputTokens: 128_000, capabilities: flagship,163 input: 1, cachedInput: 0.05, cacheWrite: 1.25, output: 5, acceptsSampling: false, reasoningEfforts: allEfforts),164 .init(id: "gpt-6-luna", displayName: "GPT-6 Luna", contextLength: 1_050_000, maxOutputTokens: 128_000, capabilities: flagship,165 input: 0.10, cachedInput: 0.01, cacheWrite: 0.125, output: 0.50, acceptsSampling: false, reasoningEfforts: allEfforts),166 // Listed on the pricing page; limits and modalities were not read from a model page, so only the price is claimed.167 .init(id: "gpt-6.1-sol", displayName: "GPT-6.1 Sol", capabilities: [.text], input: 2, cachedInput: 0.10, output: 10, acceptsSampling: false, reasoningEfforts: basicEfforts),168 .init(id: "gpt-6-astra", displayName: "GPT-6 Astra", capabilities: [.text], input: 10, cachedInput: 1, output: 50, acceptsSampling: false, reasoningEfforts: basicEfforts),169 .init(id: "gpt-6-sol", displayName: "GPT-6 Sol", capabilities: [.text], input: 2, cachedInput: 0.20, output: 10, acceptsSampling: false, reasoningEfforts: basicEfforts),170 .init(id: "gpt-5.6-sol", displayName: "GPT-5.6 Sol", capabilities: [.text], input: 4, cachedInput: 0.40, output: 20, acceptsSampling: false, reasoningEfforts: basicEfforts),171 .init(id: "gpt-5.6-terra", displayName: "GPT-5.6 Terra", capabilities: [.text], input: 2, cachedInput: 0.20, output: 12, acceptsSampling: false, reasoningEfforts: basicEfforts),172 .init(id: "gpt-5.6-luna", displayName: "GPT-5.6 Luna", capabilities: [.text], input: 0.20, cachedInput: 0.02, output: 1.20, acceptsSampling: false, reasoningEfforts: basicEfforts),173 .init(id: "gpt-5.5", displayName: "GPT-5.5", capabilities: [.text], input: 5, cachedInput: 0.50, output: 30, acceptsSampling: false, reasoningEfforts: basicEfforts),174 .init(id: "gpt-5.4", displayName: "GPT-5.4", capabilities: [.text], input: 2.50, cachedInput: 0.25, output: 15, acceptsSampling: false, reasoningEfforts: basicEfforts),175 .init(id: "gpt-5.4-mini", displayName: "GPT-5.4 mini", capabilities: [.text], input: 0.75, cachedInput: 0.075, output: 4.50, acceptsSampling: false, reasoningEfforts: basicEfforts),176 .init(id: "gpt-5.4-nano", displayName: "GPT-5.4 nano", capabilities: [.text], input: 0.20, cachedInput: 0.02, output: 1.25, acceptsSampling: false, reasoningEfforts: basicEfforts),177 .init(id: "gpt-5.2", displayName: "GPT-5.2", capabilities: [.text], input: 1.75, cachedInput: 0.175, output: 14, acceptsSampling: false, reasoningEfforts: basicEfforts),178 .init(id: "gpt-5.1", displayName: "GPT-5.1", capabilities: [.text], input: 1.25, cachedInput: 0.125, output: 10, acceptsSampling: false, reasoningEfforts: basicEfforts),179 .init(id: "gpt-5", displayName: "GPT-5", capabilities: [.text], input: 1.25, cachedInput: 0.125, output: 10, acceptsSampling: false, reasoningEfforts: basicEfforts),180 .init(id: "gpt-5-mini", displayName: "GPT-5 mini", capabilities: [.text], input: 0.25, cachedInput: 0.025, output: 2, acceptsSampling: false, reasoningEfforts: basicEfforts),181 .init(id: "gpt-5-nano", displayName: "GPT-5 nano", capabilities: [.text], input: 0.05, cachedInput: 0.005, output: 0.40, acceptsSampling: false, reasoningEfforts: basicEfforts),182 .init(id: "o3", displayName: "o3", capabilities: [.text], input: 2, cachedInput: 0.50, output: 8, acceptsSampling: false, reasoningEfforts: basicEfforts),183 .init(id: "gpt-4.1", displayName: "GPT-4.1", capabilities: [.text], input: 2, cachedInput: 0.50, output: 8, acceptsSampling: true, reasoningEfforts: []),184 .init(id: "gpt-4.1-mini", displayName: "GPT-4.1 mini", capabilities: [.text], input: 0.40, cachedInput: 0.10, output: 1.60, acceptsSampling: true, reasoningEfforts: []),185 .init(id: "gpt-4o", displayName: "GPT-4o", capabilities: [.text], input: 2.50, cachedInput: 1.25, output: 10, acceptsSampling: true, reasoningEfforts: []),186 .init(id: "gpt-4o-mini", displayName: "GPT-4o mini", capabilities: [.text], input: 0.15, cachedInput: 0.075, output: 0.60, acceptsSampling: true, reasoningEfforts: []),187 ]188189 static func openAI(_ modelID: String) -> OpenAIEntry? { lookup(modelID, in: openAI, id: \.id) }190191 // MARK: Anthropic192193 enum ThinkingOff: Sendable, Equatable {194 /// `thinking: {"type": "disabled"}` is accepted.195 case disabled196 /// Thinking cannot be disabled; `{"type": "between_tools"}` turns off up-front thinking (Claude Sonnet 5.5).197 case betweenTools198 /// Thinking is always on (Fable, Opus 5.5): the lowest effort is the closest setting.199 case unavailable200 }201202 enum Thinking: Sendable, Equatable {203 /// `thinking: {"type": "adaptive"}` with depth set by `output_config.effort`.204 /// `onByDefault`: omitting `thinking` runs adaptive. `summaryOptIn`: summaries are omitted unless `display: "summarized"` is sent.205 case adaptive(off: ThinkingOff, onByDefault: Bool, summaryOptIn: Bool)206 /// Manual extended thinking: `{"type": "enabled", "budget_tokens": N}`; no adaptive mode.207 case budget208 }209210 struct AnthropicEntry: Sendable {211 var id: String212 var displayName: String213 var contextLength: Int214 var maxOutputTokens: Int215 var input: Double216 var cacheWrite: Double217 var cacheRead: Double218 var output: Double219 var thinking: Thinking220 /// Whether `output_config.effort` is accepted.221 var effort: Bool222 /// Shortest prefix, in tokens, the prompt cache stores for this model.223 var cacheMinimumTokens: Int224 }225226 static let anthropicPricingURL = "https://platform.claude.com/docs/en/about-claude/pricing"227 static let anthropicCapabilities: Set<Capability> = [.text, .vision, .tools, .reasoning, .structuredOutput, .promptCaching, .documents]228 private static let alwaysOn = Thinking.adaptive(off: .unavailable, onByDefault: true, summaryOptIn: true)229 private static let defaultOn = Thinking.adaptive(off: .disabled, onByDefault: true, summaryOptIn: true)230 private static let optIn47 = Thinking.adaptive(off: .disabled, onByDefault: false, summaryOptIn: true)231 private static let optIn46 = Thinking.adaptive(off: .disabled, onByDefault: false, summaryOptIn: false)232233 static let anthropic: [AnthropicEntry] = [234 .init(id: "claude-fable-5-2", displayName: "Claude Fable 5.2", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 8, cacheWrite: 10, cacheRead: 0.20, output: 40, thinking: alwaysOn, effort: true, cacheMinimumTokens: 512),235 .init(id: "claude-mythos-5-2", displayName: "Claude Mythos 5.2", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 8, cacheWrite: 10, cacheRead: 0.20, output: 40, thinking: alwaysOn, effort: true, cacheMinimumTokens: 512),236 .init(id: "claude-fable-5-1", displayName: "Claude Fable 5.1", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 10, cacheWrite: 12.50, cacheRead: 0.25, output: 50, thinking: alwaysOn, effort: true, cacheMinimumTokens: 512),237 .init(id: "claude-mythos-5-1", displayName: "Claude Mythos 5.1", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 10, cacheWrite: 12.50, cacheRead: 0.25, output: 50, thinking: alwaysOn, effort: true, cacheMinimumTokens: 512),238 .init(id: "claude-fable-5", displayName: "Claude Fable 5", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 10, cacheWrite: 12.50, cacheRead: 1, output: 50, thinking: alwaysOn, effort: true, cacheMinimumTokens: 512),239 .init(id: "claude-mythos-5", displayName: "Claude Mythos 5", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 10, cacheWrite: 12.50, cacheRead: 1, output: 50, thinking: alwaysOn, effort: true, cacheMinimumTokens: 512),240 .init(id: "claude-opus-5-5", displayName: "Claude Opus 5.5", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 4, cacheWrite: 5, cacheRead: 0.20, output: 20, thinking: alwaysOn, effort: true, cacheMinimumTokens: 512),241 .init(id: "claude-opus-5", displayName: "Claude Opus 5", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 5, cacheWrite: 6.25, cacheRead: 0.50, output: 25, thinking: defaultOn, effort: true, cacheMinimumTokens: 512),242 .init(id: "claude-opus-4-8", displayName: "Claude Opus 4.8", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 5, cacheWrite: 6.25, cacheRead: 0.50, output: 25, thinking: optIn47, effort: true, cacheMinimumTokens: 1024),243 .init(id: "claude-opus-4-7", displayName: "Claude Opus 4.7", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 5, cacheWrite: 6.25, cacheRead: 0.50, output: 25, thinking: optIn47, effort: true, cacheMinimumTokens: 2048),244 .init(id: "claude-opus-4-6", displayName: "Claude Opus 4.6", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 5, cacheWrite: 6.25, cacheRead: 0.50, output: 25, thinking: optIn46, effort: true, cacheMinimumTokens: 4096),245 .init(id: "claude-opus-4-5", displayName: "Claude Opus 4.5", contextLength: 200_000, maxOutputTokens: 64_000, input: 5, cacheWrite: 6.25, cacheRead: 0.50, output: 25, thinking: .budget, effort: true, cacheMinimumTokens: 4096),246 .init(id: "claude-sonnet-5-5", displayName: "Claude Sonnet 5.5", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 2, cacheWrite: 2.50, cacheRead: 0.10, output: 10,247 thinking: .adaptive(off: .betweenTools, onByDefault: true, summaryOptIn: true), effort: true, cacheMinimumTokens: 512),248 .init(id: "claude-sonnet-5", displayName: "Claude Sonnet 5", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 2, cacheWrite: 2.50, cacheRead: 0.20, output: 10, thinking: defaultOn, effort: true, cacheMinimumTokens: 1024),249 .init(id: "claude-sonnet-4-6", displayName: "Claude Sonnet 4.6", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 3, cacheWrite: 3.75, cacheRead: 0.30, output: 15, thinking: optIn46, effort: true, cacheMinimumTokens: 1024),250 .init(id: "claude-sonnet-4-5", displayName: "Claude Sonnet 4.5", contextLength: 200_000, maxOutputTokens: 64_000, input: 3, cacheWrite: 3.75, cacheRead: 0.30, output: 15, thinking: .budget, effort: false, cacheMinimumTokens: 1024),251 // Prices for prompts up to 100,000 tokens; above that Haiku 5.5 is billed 0.50 / 2.50.252 .init(id: "claude-haiku-5-5", displayName: "Claude Haiku 5.5", contextLength: 1_000_000, maxOutputTokens: 128_000, input: 0.10, cacheWrite: 0.125, cacheRead: 0.01, output: 0.50, thinking: defaultOn, effort: true, cacheMinimumTokens: 512),253 .init(id: "claude-haiku-4-5", displayName: "Claude Haiku 4.5", contextLength: 200_000, maxOutputTokens: 64_000, input: 1, cacheWrite: 1.25, cacheRead: 0.10, output: 5, thinking: .budget, effort: false, cacheMinimumTokens: 4096),254 ]255256 static func anthropic(_ modelID: String) -> AnthropicEntry? { lookup(modelID, in: anthropic, id: \.id) }257258 // MARK: Google Gemini259260 struct GeminiEntry: Sendable {261 var id: String262 var input: Double263 var cachedInput: Double264 var output: Double265 /// Input modalities stated on the pricing page ("text / image / video") or exercised live on 2026-11-21.266 var capabilities: Set<Capability>267 }268269 static let geminiPricingURL = "https://aistudio.google.com/docs/pricing"270 private static let geminiSeen: Set<Capability> = [.text, .vision, .tools, .promptCaching]271 private static let geminiPriced: Set<Capability> = [.text, .promptCaching]272273 /// Standard paid tier. 2.5 Pro and 3.1 Pro prices are for prompts up to 200,000 tokens.274 static let gemini: [GeminiEntry] = [275 .init(id: "gemini-4-carbon", input: 2, cachedInput: 0.10, output: 10, capabilities: geminiPriced),276 .init(id: "gemini-4-argon", input: 2, cachedInput: 0.10, output: 10, capabilities: geminiPriced),277 .init(id: "gemini-4-neon", input: 3, cachedInput: 0.15, output: 15, capabilities: geminiPriced),278 .init(id: "gemini-4-hydrogen", input: 1.50, cachedInput: 0.075, output: 7.50, capabilities: [.text, .tools, .promptCaching]),279 .init(id: "gemini-3.6-flash", input: 0.75, cachedInput: 0.075, output: 3.75, capabilities: geminiPriced),280 .init(id: "gemini-3.5-flash-lite", input: 0.30, cachedInput: 0.03, output: 2.50, capabilities: geminiPriced),281 .init(id: "gemini-3.1-pro-preview", input: 2, cachedInput: 0.20, output: 12, capabilities: geminiPriced),282 .init(id: "gemini-3.1-flash-lite", input: 0.25, cachedInput: 0.025, output: 1.50, capabilities: geminiSeen),283 .init(id: "gemini-3-flash-preview", input: 0.50, cachedInput: 0.05, output: 3, capabilities: [.text, .vision, .promptCaching]),284 .init(id: "gemini-2.5-pro", input: 1.25, cachedInput: 0.125, output: 10, capabilities: geminiPriced),285 .init(id: "gemini-2.5-flash", input: 0.30, cachedInput: 0.03, output: 2.50, capabilities: [.text, .vision, .promptCaching]),286 .init(id: "gemini-2.5-flash-lite", input: 0.10, cachedInput: 0.01, output: 0.40, capabilities: geminiSeen),287 ]288289 static func gemini(_ modelID: String) -> GeminiEntry? { gemini.first { $0.id == modelID } }290291 // MARK: DeepSeek292293 struct DeepSeekEntry: Sendable {294 var id: String295 /// Cache-miss input price.296 var input: Double297 var cachedInput: Double298 var output: Double299 var capabilities: Set<Capability>300 }301302 static let deepSeekVerifiedOn = "2026-11-22"303 static let deepSeekPricingURL = "https://api-docs.deepseek.com/quick_start/pricing"304 private static let deepSeekDocumented: Set<Capability> = [.text, .tools, .reasoning, .promptCaching]305306 /// Peak-hour prices (01:00–04:00 and 06:00–10:00 UTC on weekdays). Off-peak prices are half of these, so an estimate built on307 /// this table never understates the cost. Vision is not listed here: it comes from the model list's `input_modalities`.308 static let deepSeek: [DeepSeekEntry] = [309 .init(id: "deepseek-flash", input: 0.30, cachedInput: 0.006, output: 1.20, capabilities: deepSeekDocumented),310 .init(id: "deepseek-v4-pro", input: 1.32, cachedInput: 0.044, output: 3.96, capabilities: deepSeekDocumented),311 ]312313 static func deepSeek(_ modelID: String) -> DeepSeekEntry? { deepSeek.first { $0.id == modelID } }314315 static func pricing(_ e: DeepSeekEntry) -> Pricing {316 Pricing(inputPerMTok: e.input, outputPerMTok: e.output, cachedInputPerMTok: e.cachedInput, asOf: deepSeekVerifiedOn, sourceURL: deepSeekPricingURL)317 }318319 // MARK: Moonshot320321 static let moonshotVerifiedOn = "2026-11-22"322 static let moonshotChatURL = "https://platform.kimi.ai/docs/api/chat"323 /// Models on which a tool round trip was exercised live on 2026-11-22. The model list does not report tool calling.324 static let moonshotToolModels: Set<String> = ["kimi-k3.1-pro", "kimi-k3.1-pro-highspeed", "kimi-k3", "kimi-k2.7-code", "kimi-k2.7-code-highspeed", "kimi-k2.6"]325326 // MARK: Lookup327328 /// Exact id, or a dated snapshot of it (`gpt-6-luna-2026-09-08`, `claude-haiku-4-5-20251001`).329 private static func lookup<E>(_ modelID: String, in table: [E], id: KeyPath<E, String>) -> E? {330 if let exact = table.first(where: { $0[keyPath: id] == modelID }) { return exact }331 return table332 .filter { entry in333 let base = entry[keyPath: id]334 guard modelID.hasPrefix(base + "-") else { return false }335 let suffix = modelID.dropFirst(base.count + 1)336 return suffix.range(of: #"^(\d{8}|\d{4}-\d{2}-\d{2})$"#, options: .regularExpression) != nil337 }338 .max { $0[keyPath: id].count < $1[keyPath: id].count }339 }340341 static func pricing(_ e: OpenAIEntry) -> Pricing {342 Pricing(inputPerMTok: e.input, outputPerMTok: e.output, cachedInputPerMTok: e.cachedInput, cacheWritePerMTok: e.cacheWrite, asOf: verifiedOn, sourceURL: openAIPricingURL)343 }344345 static func pricing(_ e: AnthropicEntry) -> Pricing {346 Pricing(inputPerMTok: e.input, outputPerMTok: e.output, cachedInputPerMTok: e.cacheRead, cacheWritePerMTok: e.cacheWrite, asOf: verifiedOn, sourceURL: anthropicPricingURL)347 }348349 static func pricing(_ e: GeminiEntry) -> Pricing {350 Pricing(inputPerMTok: e.input, outputPerMTok: e.output, cachedInputPerMTok: e.cachedInput, asOf: verifiedOn, sourceURL: geminiPricingURL)351 }352353 /// Curated metadata for a model, when this file has an entry for it. Limits reported live by a provider API take precedence in `listModels()`.354 public static func info(for ref: ModelRef) -> ModelInfo? {355 switch ref.provider {356 case .openAI:357 guard let e = openAI(ref.modelID) else { return nil }358 return ModelInfo(ref: ref, displayName: e.id == ref.modelID ? e.displayName : ref.modelID, contextLength: e.contextLength, maxOutputTokens: e.maxOutputTokens,359 capabilities: e.capabilities, source: .documentation(asOf: verifiedOn, url: e.contextLength == nil ? openAIPricingURL : openAIModelsURL),360 pricing: pricing(e), vendor: "openai")361 case .anthropic:362 guard let e = anthropic(ref.modelID) else { return nil }363 return ModelInfo(ref: ref, displayName: e.displayName, contextLength: e.contextLength, maxOutputTokens: e.maxOutputTokens, capabilities: anthropicCapabilities,364 source: .documentation(asOf: verifiedOn, url: anthropicPricingURL), pricing: pricing(e), vendor: "anthropic")365 case .google:366 guard let e = gemini(ref.modelID) else { return nil }367 return ModelInfo(ref: ref, displayName: ref.modelID, capabilities: e.capabilities, source: .documentation(asOf: verifiedOn, url: geminiPricingURL),368 pricing: pricing(e), vendor: "google")369 case .deepSeek:370 guard let e = deepSeek(ref.modelID) else { return nil }371 return ModelInfo(ref: ref, displayName: ref.modelID, capabilities: e.capabilities, source: .documentation(asOf: deepSeekVerifiedOn, url: deepSeekPricingURL),372 pricing: pricing(e), vendor: "deepseek")373 case .moonshot:374 guard moonshotToolModels.contains(ref.modelID) else { return nil }375 return ModelInfo(ref: ref, displayName: ref.modelID, capabilities: [.text, .tools], source: .documentation(asOf: moonshotVerifiedOn, url: moonshotChatURL),376 vendor: "moonshot")377 default: return nil378 }379 }380}381