providers.go 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584
  1. // AUTO-GENERATED FILE - DO NOT MODIFY DIRECTLY
  2. // Generated by scripts/generate-provider-definitions.mjs
  3. // Source: src/shared/api.ts
  4. //
  5. // ============================================================================
  6. // DATA CONTRACT & DOCUMENTATION
  7. // ============================================================================
  8. //
  9. // This file provides structured provider metadata extracted from TypeScript source.
  10. // It serves as the bridge between the VSCode extension's TypeScript API definitions
  11. // and the CLI's Go-based setup wizard.
  12. //
  13. // CORE STRUCTURES
  14. // ===============
  15. //
  16. // ConfigField: Individual configuration fields with type, category, and validation metadata
  17. // - Name: Field name as it appears in ApiHandlerOptions (e.g., "cerebrasApiKey")
  18. // - Type: TypeScript type (e.g., "string", "number")
  19. // - Comment: Inline comment from TypeScript source
  20. // - Category: Provider categorization (e.g., "cerebras", "general")
  21. // - Required: Whether this field MUST be collected for any provider
  22. // - FieldType: UI field type hint ("password", "url", "string", "select")
  23. // - Placeholder: Suggested placeholder text for UI input
  24. //
  25. // ModelInfo: Model capabilities, pricing, and limits
  26. // - MaxTokens: Maximum output tokens
  27. // - ContextWindow: Total context window size
  28. // - SupportsImages: Whether model accepts image inputs
  29. // - SupportsPromptCache: Whether model supports prompt caching
  30. // - InputPrice: Cost per 1M input tokens (USD)
  31. // - OutputPrice: Cost per 1M output tokens (USD)
  32. // - CacheWritesPrice: Cost per 1M cached tokens written (USD)
  33. // - CacheReadsPrice: Cost per 1M cached tokens read (USD)
  34. // - Description: Human-readable model description
  35. //
  36. // ProviderDefinition: Complete provider metadata including required/optional fields
  37. // - ID: Provider identifier (e.g., "cerebras", "anthropic")
  38. // - Name: Human-readable display name (e.g., "Cerebras", "Anthropic (Claude)")
  39. // - RequiredFields: Fields that MUST be collected (filtered by category + overrides)
  40. // - OptionalFields: Fields that MAY be collected (filtered by category + overrides)
  41. // - Models: Map of model IDs to ModelInfo
  42. // - DefaultModelID: Recommended default model from TypeScript source
  43. // - HasDynamicModels: Whether provider supports runtime model discovery
  44. // - SetupInstructions: User-facing setup guidance
  45. //
  46. // FIELD FILTERING LOGIC
  47. // =====================
  48. //
  49. // Fields are categorized during parsing based on provider-specific prefixes in field names:
  50. // - "cerebrasApiKey" → category="cerebras"
  51. // - "awsAccessKey" → category="aws" (used by bedrock)
  52. // - "requestTimeoutMs" → category="general" (applies to all providers)
  53. //
  54. // The getFieldsByProvider() function filters fields using this priority:
  55. // 1. Check field_overrides.go via GetFieldOverride() for manual corrections
  56. // 2. Match field.Category against provider ID (primary filtering)
  57. // 3. Apply hardcoded switch cases for complex provider relationships
  58. // 4. Include universal fields (requestTimeoutMs, ulid, clineAccountId) for all providers
  59. //
  60. // Required vs Optional:
  61. // - Fields are marked as required if they appear in the providerRequiredFields map
  62. // in the generator script (scripts/generate-provider-definitions.mjs)
  63. // - getFieldsByProvider() respects the required parameter to separate required/optional
  64. //
  65. // MODEL SELECTION
  66. // ===============
  67. //
  68. // DefaultModelID extraction priority:
  69. // 1. Exact match from TypeScript constant (e.g., cerebrasDefaultModelId = "llama-3.3-70b")
  70. // 2. Pattern matching on model IDs ("latest", "default", "sonnet", "gpt-4", etc.)
  71. // 3. First model in the models map
  72. //
  73. // Models map contains full capability and pricing data extracted from TypeScript model
  74. // definitions (e.g., cerebrasModels, anthropicModels).
  75. //
  76. // HasDynamicModels indicates providers that support runtime model discovery via API
  77. // (e.g., OpenRouter, Ollama, LM Studio). For these providers, the models map may be
  78. // incomplete or a representative sample.
  79. //
  80. // USAGE EXAMPLE
  81. // =============
  82. //
  83. // def, err := GetProviderDefinition("cerebras")
  84. // if err != nil {
  85. // return err
  86. // }
  87. //
  88. // // Collect required fields from user
  89. // for _, field := range def.RequiredFields {
  90. // value := promptUser(field.Name, field.Placeholder, field.FieldType == "password")
  91. // config[field.Name] = value
  92. // }
  93. //
  94. // // Use default model or let user choose
  95. // if def.DefaultModelID != "" {
  96. // config["modelId"] = def.DefaultModelID
  97. // }
  98. //
  99. // EXTENDING & OVERRIDING
  100. // ======================
  101. //
  102. // DO NOT modify this generated file directly. Changes will be lost on regeneration.
  103. //
  104. // To fix incorrect field categorization:
  105. // - Edit cli/pkg/generated/field_overrides.go
  106. // - Add entries to GetFieldOverride() function
  107. // - Example: Force "awsSessionToken" to be relevant for "bedrock"
  108. //
  109. // To change required fields:
  110. // - Edit providerRequiredFields map in scripts/generate-provider-definitions.mjs
  111. // - Rerun: npm run generate-provider-definitions
  112. //
  113. // To add new providers:
  114. // - Add to ApiProvider type in src/shared/api.ts
  115. // - Add fields to ApiHandlerOptions with provider-specific prefixes
  116. // - Optionally add model definitions (e.g., export const newProviderModels = {...})
  117. // - Rerun generator
  118. //
  119. // To fix default model extraction:
  120. // - Ensure TypeScript source has: export const <provider>DefaultModelId = "model-id"
  121. // - Or update extractDefaultModelIds() patterns in generator script
  122. //
  123. // For upstream changes:
  124. // - Submit pull request to src/shared/api.ts in the main repository
  125. //
  126. // ============================================================================
  127. package generated
  128. import (
  129. "encoding/json"
  130. "fmt"
  131. "strings"
  132. )
  133. // Provider constants
  134. const (
  135. ANTHROPIC = "anthropic"
  136. OPENROUTER = "openrouter"
  137. BEDROCK = "bedrock"
  138. OPENAI = "openai"
  139. OLLAMA = "ollama"
  140. GEMINI = "gemini"
  141. OPENAI_NATIVE = "openai-native"
  142. XAI = "xai"
  143. CEREBRAS = "cerebras"
  144. OCA = "oca"
  145. NOUSRESEARCH = "nousResearch"
  146. )
  147. // AllProviders returns a slice of enabled provider IDs for the CLI build.
  148. // This is a filtered subset of all providers available in the VSCode extension.
  149. // To modify which providers are included, edit ENABLED_PROVIDERS in scripts/cli-providers.mjs
  150. var AllProviders = []string{
  151. "anthropic",
  152. "openrouter",
  153. "bedrock",
  154. "openai",
  155. "ollama",
  156. "gemini",
  157. "openai-native",
  158. "xai",
  159. "cerebras",
  160. "oca",
  161. "nousResearch",
  162. }
  163. // ConfigField represents a configuration field requirement
  164. type ConfigField struct {
  165. Name string `json:"name"`
  166. Type string `json:"type"`
  167. Comment string `json:"comment"`
  168. Category string `json:"category"`
  169. Required bool `json:"required"`
  170. FieldType string `json:"fieldType"`
  171. Placeholder string `json:"placeholder"`
  172. }
  173. // ModelInfo represents model capabilities and pricing
  174. type ModelInfo struct {
  175. MaxTokens int `json:"maxTokens,omitempty"`
  176. ContextWindow int `json:"contextWindow,omitempty"`
  177. SupportsImages bool `json:"supportsImages"`
  178. SupportsPromptCache bool `json:"supportsPromptCache"`
  179. InputPrice float64 `json:"inputPrice,omitempty"`
  180. OutputPrice float64 `json:"outputPrice,omitempty"`
  181. CacheWritesPrice float64 `json:"cacheWritesPrice,omitempty"`
  182. CacheReadsPrice float64 `json:"cacheReadsPrice,omitempty"`
  183. Description string `json:"description,omitempty"`
  184. }
  185. // ProviderDefinition represents a provider's metadata and requirements
  186. type ProviderDefinition struct {
  187. ID string `json:"id"`
  188. Name string `json:"name"`
  189. RequiredFields []ConfigField `json:"requiredFields"`
  190. OptionalFields []ConfigField `json:"optionalFields"`
  191. Models map[string]ModelInfo `json:"models"`
  192. DefaultModelID string `json:"defaultModelId"`
  193. HasDynamicModels bool `json:"hasDynamicModels"`
  194. SetupInstructions string `json:"setupInstructions"`
  195. }
  196. // Raw configuration fields data (parsed from TypeScript)
  197. var rawConfigFields = ` [
  198. {
  199. "name": "apiKey",
  200. "type": "string",
  201. "comment": "anthropic",
  202. "category": "anthropic",
  203. "required": true,
  204. "fieldType": "password",
  205. "placeholder": "Enter your API key"
  206. },
  207. {
  208. "name": "awsAccessKey",
  209. "type": "string",
  210. "comment": "",
  211. "category": "bedrock",
  212. "required": true,
  213. "fieldType": "password",
  214. "placeholder": "Enter your API key"
  215. },
  216. {
  217. "name": "awsSecretKey",
  218. "type": "string",
  219. "comment": "",
  220. "category": "bedrock",
  221. "required": true,
  222. "fieldType": "password",
  223. "placeholder": "Enter your API key"
  224. },
  225. {
  226. "name": "openRouterApiKey",
  227. "type": "string",
  228. "comment": "",
  229. "category": "openrouter",
  230. "required": true,
  231. "fieldType": "password",
  232. "placeholder": "Enter your API key"
  233. },
  234. {
  235. "name": "awsSessionToken",
  236. "type": "string",
  237. "comment": "",
  238. "category": "bedrock",
  239. "required": true,
  240. "fieldType": "password",
  241. "placeholder": "Enter your API key"
  242. },
  243. {
  244. "name": "awsBedrockApiKey",
  245. "type": "string",
  246. "comment": "",
  247. "category": "bedrock",
  248. "required": true,
  249. "fieldType": "password",
  250. "placeholder": "Enter your API key"
  251. },
  252. {
  253. "name": "openAiApiKey",
  254. "type": "string",
  255. "comment": "",
  256. "category": "openai",
  257. "required": true,
  258. "fieldType": "password",
  259. "placeholder": "Enter your API key"
  260. },
  261. {
  262. "name": "geminiApiKey",
  263. "type": "string",
  264. "comment": "",
  265. "category": "gemini",
  266. "required": true,
  267. "fieldType": "password",
  268. "placeholder": "Enter your API key"
  269. },
  270. {
  271. "name": "openAiNativeApiKey",
  272. "type": "string",
  273. "comment": "",
  274. "category": "openai-native",
  275. "required": true,
  276. "fieldType": "password",
  277. "placeholder": "Enter your API key"
  278. },
  279. {
  280. "name": "ollamaApiKey",
  281. "type": "string",
  282. "comment": "",
  283. "category": "ollama",
  284. "required": true,
  285. "fieldType": "password",
  286. "placeholder": "Enter your API key"
  287. },
  288. {
  289. "name": "authNonce",
  290. "type": "string",
  291. "comment": "",
  292. "category": "general",
  293. "required": true,
  294. "fieldType": "password",
  295. "placeholder": "Enter your API key"
  296. },
  297. {
  298. "name": "xaiApiKey",
  299. "type": "string",
  300. "comment": "",
  301. "category": "xai",
  302. "required": true,
  303. "fieldType": "password",
  304. "placeholder": "Enter your API key"
  305. },
  306. {
  307. "name": "cerebrasApiKey",
  308. "type": "string",
  309. "comment": "",
  310. "category": "cerebras",
  311. "required": true,
  312. "fieldType": "password",
  313. "placeholder": "Enter your API key"
  314. },
  315. {
  316. "name": "nousResearchApiKey",
  317. "type": "string",
  318. "comment": "",
  319. "category": "nousResearch",
  320. "required": true,
  321. "fieldType": "password",
  322. "placeholder": "Enter your API key"
  323. },
  324. {
  325. "name": "ulid",
  326. "type": "string",
  327. "comment": "Used to identify the task in API requests",
  328. "category": "general",
  329. "required": false,
  330. "fieldType": "string",
  331. "placeholder": ""
  332. },
  333. {
  334. "name": "openAiHeaders",
  335. "type": "Record<string, string>",
  336. "comment": "Custom headers for OpenAI requests",
  337. "category": "openai",
  338. "required": false,
  339. "fieldType": "string",
  340. "placeholder": ""
  341. },
  342. {
  343. "name": "anthropicBaseUrl",
  344. "type": "string",
  345. "comment": "",
  346. "category": "anthropic",
  347. "required": false,
  348. "fieldType": "url",
  349. "placeholder": "https://api.example.com"
  350. },
  351. {
  352. "name": "openRouterProviderSorting",
  353. "type": "string",
  354. "comment": "",
  355. "category": "openrouter",
  356. "required": false,
  357. "fieldType": "string",
  358. "placeholder": ""
  359. },
  360. {
  361. "name": "openAiBaseUrl",
  362. "type": "string",
  363. "comment": "",
  364. "category": "openai",
  365. "required": false,
  366. "fieldType": "url",
  367. "placeholder": "https://api.example.com"
  368. },
  369. {
  370. "name": "ollamaBaseUrl",
  371. "type": "string",
  372. "comment": "",
  373. "category": "ollama",
  374. "required": false,
  375. "fieldType": "url",
  376. "placeholder": "https://api.example.com"
  377. },
  378. {
  379. "name": "ollamaApiOptionsCtxNum",
  380. "type": "string",
  381. "comment": "",
  382. "category": "ollama",
  383. "required": false,
  384. "fieldType": "string",
  385. "placeholder": ""
  386. },
  387. {
  388. "name": "geminiBaseUrl",
  389. "type": "string",
  390. "comment": "",
  391. "category": "gemini",
  392. "required": false,
  393. "fieldType": "url",
  394. "placeholder": "https://api.example.com"
  395. },
  396. {
  397. "name": "azureApiVersion",
  398. "type": "string",
  399. "comment": "",
  400. "category": "general",
  401. "required": false,
  402. "fieldType": "string",
  403. "placeholder": ""
  404. },
  405. {
  406. "name": "requestTimeoutMs",
  407. "type": "number",
  408. "comment": "",
  409. "category": "general",
  410. "required": false,
  411. "fieldType": "string",
  412. "placeholder": ""
  413. },
  414. {
  415. "name": "sapAiResourceGroup",
  416. "type": "string",
  417. "comment": "",
  418. "category": "general",
  419. "required": false,
  420. "fieldType": "string",
  421. "placeholder": ""
  422. },
  423. {
  424. "name": "onRetryAttempt",
  425. "type": "(attempt: number, maxRetries: number, delay: number, error: any) => void",
  426. "comment": "",
  427. "category": "general",
  428. "required": false,
  429. "fieldType": "string",
  430. "placeholder": ""
  431. },
  432. {
  433. "name": "ocaBaseUrl",
  434. "type": "string",
  435. "comment": "",
  436. "category": "general",
  437. "required": false,
  438. "fieldType": "url",
  439. "placeholder": "https://api.example.com"
  440. },
  441. {
  442. "name": "minimaxApiLine",
  443. "type": "string",
  444. "comment": "",
  445. "category": "general",
  446. "required": false,
  447. "fieldType": "string",
  448. "placeholder": ""
  449. },
  450. {
  451. "name": "ocaMode",
  452. "type": "string",
  453. "comment": "",
  454. "category": "general",
  455. "required": false,
  456. "fieldType": "string",
  457. "placeholder": ""
  458. },
  459. {
  460. "name": "hicapApiKey",
  461. "type": "string",
  462. "comment": "",
  463. "category": "general",
  464. "required": true,
  465. "fieldType": "password",
  466. "placeholder": "Enter your API key"
  467. },
  468. ]`
  469. // Raw model definitions data (parsed from TypeScript)
  470. var rawModelDefinitions = ` {
  471. "anthropic": {
  472. "claude-sonnet-4-5-20250929": {
  473. "maxTokens": 8192,
  474. "contextWindow": 200000,
  475. "inputPrice": 3,
  476. "outputPrice": 15,
  477. "cacheWritesPrice": 3,
  478. "cacheReadsPrice": 0,
  479. "supportsImages": true,
  480. "supportsPromptCache": true
  481. },
  482. "claude-sonnet-4-5-20250929:1m": {
  483. "maxTokens": 8192,
  484. "contextWindow": 1000000,
  485. "inputPrice": 3,
  486. "outputPrice": 15,
  487. "cacheWritesPrice": 3,
  488. "cacheReadsPrice": 0,
  489. "supportsImages": true,
  490. "supportsPromptCache": true
  491. },
  492. "claude-haiku-4-5-20251001": {
  493. "maxTokens": 8192,
  494. "contextWindow": 200000,
  495. "inputPrice": 1,
  496. "outputPrice": 5,
  497. "cacheWritesPrice": 1,
  498. "cacheReadsPrice": 0,
  499. "supportsImages": true,
  500. "supportsPromptCache": true
  501. },
  502. "claude-sonnet-4-20250514": {
  503. "maxTokens": 8192,
  504. "contextWindow": 200000,
  505. "inputPrice": 3,
  506. "outputPrice": 15,
  507. "cacheWritesPrice": 3,
  508. "cacheReadsPrice": 0,
  509. "supportsImages": true,
  510. "supportsPromptCache": true
  511. },
  512. "claude-sonnet-4-20250514:1m": {
  513. "maxTokens": 8192,
  514. "contextWindow": 1000000,
  515. "inputPrice": 3,
  516. "outputPrice": 15,
  517. "cacheWritesPrice": 3,
  518. "cacheReadsPrice": 0,
  519. "supportsImages": true,
  520. "supportsPromptCache": true
  521. },
  522. "claude-opus-4-1-20250805": {
  523. "maxTokens": 8192,
  524. "contextWindow": 200000,
  525. "inputPrice": 15,
  526. "outputPrice": 75,
  527. "cacheWritesPrice": 18,
  528. "cacheReadsPrice": 1,
  529. "supportsImages": true,
  530. "supportsPromptCache": true
  531. },
  532. "claude-opus-4-20250514": {
  533. "maxTokens": 8192,
  534. "contextWindow": 200000,
  535. "inputPrice": 15,
  536. "outputPrice": 75,
  537. "cacheWritesPrice": 18,
  538. "cacheReadsPrice": 1,
  539. "supportsImages": true,
  540. "supportsPromptCache": true
  541. },
  542. "claude-3-7-sonnet-20250219": {
  543. "maxTokens": 8192,
  544. "contextWindow": 200000,
  545. "inputPrice": 3,
  546. "outputPrice": 15,
  547. "cacheWritesPrice": 3,
  548. "cacheReadsPrice": 0,
  549. "supportsImages": true,
  550. "supportsPromptCache": true
  551. },
  552. "claude-3-5-sonnet-20241022": {
  553. "maxTokens": 8192,
  554. "contextWindow": 200000,
  555. "inputPrice": 3,
  556. "outputPrice": 15,
  557. "cacheWritesPrice": 3,
  558. "cacheReadsPrice": 0,
  559. "supportsImages": true,
  560. "supportsPromptCache": true
  561. },
  562. "claude-3-5-haiku-20241022": {
  563. "maxTokens": 8192,
  564. "contextWindow": 200000,
  565. "inputPrice": 0,
  566. "outputPrice": 4,
  567. "cacheWritesPrice": 1,
  568. "cacheReadsPrice": 0,
  569. "supportsImages": false,
  570. "supportsPromptCache": true
  571. },
  572. "claude-3-opus-20240229": {
  573. "maxTokens": 4096,
  574. "contextWindow": 200000,
  575. "inputPrice": 15,
  576. "outputPrice": 75,
  577. "cacheWritesPrice": 18,
  578. "cacheReadsPrice": 1,
  579. "supportsImages": true,
  580. "supportsPromptCache": true
  581. },
  582. "claude-3-haiku-20240307": {
  583. "maxTokens": 4096,
  584. "contextWindow": 200000,
  585. "inputPrice": 0,
  586. "outputPrice": 1,
  587. "cacheWritesPrice": 0,
  588. "cacheReadsPrice": 0,
  589. "supportsImages": true,
  590. "supportsPromptCache": true
  591. }
  592. },
  593. "bedrock": {
  594. "anthropic.claude-sonnet-4-5-20250929-v1:0": {
  595. "maxTokens": 8192,
  596. "contextWindow": 200000,
  597. "inputPrice": 3,
  598. "outputPrice": 15,
  599. "cacheWritesPrice": 3,
  600. "cacheReadsPrice": 0,
  601. "supportsImages": true,
  602. "supportsPromptCache": true
  603. },
  604. "anthropic.claude-sonnet-4-5-20250929-v1:0:1m": {
  605. "maxTokens": 8192,
  606. "contextWindow": 1000000,
  607. "inputPrice": 3,
  608. "outputPrice": 15,
  609. "cacheWritesPrice": 3,
  610. "cacheReadsPrice": 0,
  611. "supportsImages": true,
  612. "supportsPromptCache": true
  613. },
  614. "anthropic.claude-haiku-4-5-20251001-v1:0": {
  615. "maxTokens": 8192,
  616. "contextWindow": 200000,
  617. "inputPrice": 1,
  618. "outputPrice": 5,
  619. "cacheWritesPrice": 1,
  620. "cacheReadsPrice": 0,
  621. "supportsImages": true,
  622. "supportsPromptCache": true
  623. },
  624. "anthropic.claude-sonnet-4-20250514-v1:0": {
  625. "maxTokens": 8192,
  626. "contextWindow": 200000,
  627. "inputPrice": 3,
  628. "outputPrice": 15,
  629. "cacheWritesPrice": 3,
  630. "cacheReadsPrice": 0,
  631. "supportsImages": true,
  632. "supportsPromptCache": true
  633. },
  634. "anthropic.claude-sonnet-4-20250514-v1:0:1m": {
  635. "maxTokens": 8192,
  636. "contextWindow": 1000000,
  637. "inputPrice": 3,
  638. "outputPrice": 15,
  639. "cacheWritesPrice": 3,
  640. "cacheReadsPrice": 0,
  641. "supportsImages": true,
  642. "supportsPromptCache": true
  643. },
  644. "anthropic.claude-opus-4-20250514-v1:0": {
  645. "maxTokens": 8192,
  646. "contextWindow": 200000,
  647. "inputPrice": 15,
  648. "outputPrice": 75,
  649. "cacheWritesPrice": 18,
  650. "cacheReadsPrice": 1,
  651. "supportsImages": true,
  652. "supportsPromptCache": true
  653. },
  654. "anthropic.claude-opus-4-1-20250805-v1:0": {
  655. "maxTokens": 8192,
  656. "contextWindow": 200000,
  657. "inputPrice": 15,
  658. "outputPrice": 75,
  659. "cacheWritesPrice": 18,
  660. "cacheReadsPrice": 1,
  661. "supportsImages": true,
  662. "supportsPromptCache": true
  663. },
  664. "amazon.nova-premier-v1:0": {
  665. "maxTokens": 10000,
  666. "contextWindow": 1000000,
  667. "inputPrice": 2,
  668. "outputPrice": 12,
  669. "supportsImages": true,
  670. "supportsPromptCache": false
  671. },
  672. "amazon.nova-pro-v1:0": {
  673. "maxTokens": 5000,
  674. "contextWindow": 300000,
  675. "inputPrice": 0,
  676. "outputPrice": 3,
  677. "cacheWritesPrice": 3,
  678. "cacheReadsPrice": 0,
  679. "supportsImages": true,
  680. "supportsPromptCache": true
  681. },
  682. "amazon.nova-lite-v1:0": {
  683. "maxTokens": 5000,
  684. "contextWindow": 300000,
  685. "inputPrice": 0,
  686. "outputPrice": 0,
  687. "cacheWritesPrice": 0,
  688. "cacheReadsPrice": 0,
  689. "supportsImages": true,
  690. "supportsPromptCache": true
  691. },
  692. "amazon.nova-micro-v1:0": {
  693. "maxTokens": 5000,
  694. "contextWindow": 128000,
  695. "inputPrice": 0,
  696. "outputPrice": 0,
  697. "cacheWritesPrice": 0,
  698. "cacheReadsPrice": 0,
  699. "supportsImages": false,
  700. "supportsPromptCache": true
  701. },
  702. "anthropic.claude-3-7-sonnet-20250219-v1:0": {
  703. "maxTokens": 8192,
  704. "contextWindow": 200000,
  705. "inputPrice": 3,
  706. "outputPrice": 15,
  707. "cacheWritesPrice": 3,
  708. "cacheReadsPrice": 0,
  709. "supportsImages": true,
  710. "supportsPromptCache": true
  711. },
  712. "anthropic.claude-3-5-sonnet-20241022-v2:0": {
  713. "maxTokens": 8192,
  714. "contextWindow": 200000,
  715. "inputPrice": 3,
  716. "outputPrice": 15,
  717. "cacheWritesPrice": 3,
  718. "cacheReadsPrice": 0,
  719. "supportsImages": true,
  720. "supportsPromptCache": true
  721. },
  722. "anthropic.claude-3-5-haiku-20241022-v1:0": {
  723. "maxTokens": 8192,
  724. "contextWindow": 200000,
  725. "inputPrice": 0,
  726. "outputPrice": 4,
  727. "cacheWritesPrice": 1,
  728. "cacheReadsPrice": 0,
  729. "supportsImages": true,
  730. "supportsPromptCache": true
  731. },
  732. "anthropic.claude-3-5-sonnet-20240620-v1:0": {
  733. "maxTokens": 8192,
  734. "contextWindow": 200000,
  735. "inputPrice": 3,
  736. "outputPrice": 15,
  737. "supportsImages": true,
  738. "supportsPromptCache": false
  739. },
  740. "anthropic.claude-3-opus-20240229-v1:0": {
  741. "maxTokens": 4096,
  742. "contextWindow": 200000,
  743. "inputPrice": 15,
  744. "outputPrice": 75,
  745. "supportsImages": true,
  746. "supportsPromptCache": false
  747. },
  748. "anthropic.claude-3-sonnet-20240229-v1:0": {
  749. "maxTokens": 4096,
  750. "contextWindow": 200000,
  751. "inputPrice": 3,
  752. "outputPrice": 15,
  753. "supportsImages": true,
  754. "supportsPromptCache": false
  755. },
  756. "anthropic.claude-3-haiku-20240307-v1:0": {
  757. "maxTokens": 4096,
  758. "contextWindow": 200000,
  759. "inputPrice": 0,
  760. "outputPrice": 1,
  761. "supportsImages": true,
  762. "supportsPromptCache": false
  763. },
  764. "deepseek.r1-v1:0": {
  765. "maxTokens": 8000,
  766. "contextWindow": 64000,
  767. "inputPrice": 1,
  768. "outputPrice": 5,
  769. "supportsImages": false,
  770. "supportsPromptCache": false
  771. },
  772. "openai.gpt-oss-120b-1:0": {
  773. "maxTokens": 8192,
  774. "contextWindow": 128000,
  775. "inputPrice": 0,
  776. "outputPrice": 0,
  777. "supportsImages": false,
  778. "supportsPromptCache": false,
  779. "description": "A state-of-the-art 120B open-weight Mixture-of-Experts language model optimized for strong reasoning, tool use, and efficient deployment on large GPUs"
  780. },
  781. "openai.gpt-oss-20b-1:0": {
  782. "maxTokens": 8192,
  783. "contextWindow": 128000,
  784. "inputPrice": 0,
  785. "outputPrice": 0,
  786. "supportsImages": false,
  787. "supportsPromptCache": false,
  788. "description": "A compact 20B open-weight Mixture-of-Experts language model designed for strong reasoning and tool use, ideal for edge devices and local inference."
  789. },
  790. "qwen.qwen3-coder-30b-a3b-v1:0": {
  791. "maxTokens": 8192,
  792. "contextWindow": 262144,
  793. "inputPrice": 0,
  794. "outputPrice": 0,
  795. "supportsImages": false,
  796. "supportsPromptCache": false,
  797. "description": "Qwen3 Coder 30B MoE model with 3.3B activated parameters, optimized for code generation and analysis with 256K context window."
  798. },
  799. "qwen.qwen3-coder-480b-a35b-v1:0": {
  800. "maxTokens": 8192,
  801. "contextWindow": 262144,
  802. "inputPrice": 0,
  803. "outputPrice": 1,
  804. "supportsImages": false,
  805. "supportsPromptCache": false,
  806. "description": "Qwen3 Coder 480B flagship MoE model with 35B activated parameters, designed for complex coding tasks with advanced reasoning capabilities and 256K context window."
  807. }
  808. },
  809. "gemini": {
  810. "gemini-2.5-pro": {
  811. "maxTokens": 65536,
  812. "contextWindow": 1048576,
  813. "inputPrice": 2,
  814. "outputPrice": 15,
  815. "cacheReadsPrice": 0,
  816. "supportsImages": true,
  817. "supportsPromptCache": true
  818. },
  819. "gemini-2.5-flash-lite-preview-06-17": {
  820. "maxTokens": 64000,
  821. "contextWindow": 1000000,
  822. "inputPrice": 0,
  823. "outputPrice": 0,
  824. "cacheReadsPrice": 0,
  825. "supportsImages": true,
  826. "supportsPromptCache": true,
  827. "description": "Preview version - may not be available in all regions"
  828. },
  829. "gemini-2.5-flash": {
  830. "maxTokens": 65536,
  831. "contextWindow": 1048576,
  832. "inputPrice": 0,
  833. "outputPrice": 2,
  834. "cacheReadsPrice": 0,
  835. "supportsImages": true,
  836. "supportsPromptCache": true
  837. },
  838. "gemini-2.0-flash-001": {
  839. "maxTokens": 8192,
  840. "contextWindow": 1048576,
  841. "inputPrice": 0,
  842. "outputPrice": 0,
  843. "cacheWritesPrice": 1,
  844. "cacheReadsPrice": 0,
  845. "supportsImages": true,
  846. "supportsPromptCache": true
  847. },
  848. "gemini-2.0-flash-lite-preview-02-05": {
  849. "maxTokens": 8192,
  850. "contextWindow": 1048576,
  851. "inputPrice": 0,
  852. "outputPrice": 0,
  853. "supportsImages": true,
  854. "supportsPromptCache": false
  855. },
  856. "gemini-2.0-pro-exp-02-05": {
  857. "maxTokens": 8192,
  858. "contextWindow": 2097152,
  859. "inputPrice": 0,
  860. "outputPrice": 0,
  861. "supportsImages": true,
  862. "supportsPromptCache": false
  863. },
  864. "gemini-2.0-flash-thinking-exp-01-21": {
  865. "maxTokens": 65536,
  866. "contextWindow": 1048576,
  867. "inputPrice": 0,
  868. "outputPrice": 0,
  869. "supportsImages": true,
  870. "supportsPromptCache": false
  871. },
  872. "gemini-2.0-flash-thinking-exp-1219": {
  873. "maxTokens": 8192,
  874. "contextWindow": 32767,
  875. "inputPrice": 0,
  876. "outputPrice": 0,
  877. "supportsImages": true,
  878. "supportsPromptCache": false
  879. },
  880. "gemini-2.0-flash-exp": {
  881. "maxTokens": 8192,
  882. "contextWindow": 1048576,
  883. "inputPrice": 0,
  884. "outputPrice": 0,
  885. "supportsImages": true,
  886. "supportsPromptCache": false
  887. },
  888. "gemini-1.5-flash-002": {
  889. "maxTokens": 8192,
  890. "contextWindow": 1048576,
  891. "inputPrice": 0,
  892. "outputPrice": 0,
  893. "cacheWritesPrice": 1,
  894. "cacheReadsPrice": 0,
  895. "supportsImages": true,
  896. "supportsPromptCache": true
  897. },
  898. "gemini-1.5-flash-exp-0827": {
  899. "maxTokens": 8192,
  900. "contextWindow": 1048576,
  901. "inputPrice": 0,
  902. "outputPrice": 0,
  903. "supportsImages": true,
  904. "supportsPromptCache": false
  905. },
  906. "gemini-1.5-flash-8b-exp-0827": {
  907. "maxTokens": 8192,
  908. "contextWindow": 1048576,
  909. "inputPrice": 0,
  910. "outputPrice": 0,
  911. "supportsImages": true,
  912. "supportsPromptCache": false
  913. },
  914. "gemini-1.5-pro-002": {
  915. "maxTokens": 8192,
  916. "contextWindow": 2097152,
  917. "inputPrice": 0,
  918. "outputPrice": 0,
  919. "supportsImages": true,
  920. "supportsPromptCache": false
  921. },
  922. "gemini-1.5-pro-exp-0827": {
  923. "maxTokens": 8192,
  924. "contextWindow": 2097152,
  925. "inputPrice": 0,
  926. "outputPrice": 0,
  927. "supportsImages": true,
  928. "supportsPromptCache": false
  929. },
  930. "gemini-exp-1206": {
  931. "maxTokens": 8192,
  932. "contextWindow": 2097152,
  933. "inputPrice": 0,
  934. "outputPrice": 0,
  935. "supportsImages": true,
  936. "supportsPromptCache": false
  937. }
  938. },
  939. "openai-native": {
  940. "gpt-5-2025-08-07": {
  941. "maxTokens": 8192,
  942. "contextWindow": 272000,
  943. "inputPrice": 1,
  944. "outputPrice": 10,
  945. "cacheReadsPrice": 0,
  946. "supportsImages": true,
  947. "supportsPromptCache": true
  948. },
  949. "gpt-5-mini-2025-08-07": {
  950. "maxTokens": 8192,
  951. "contextWindow": 272000,
  952. "inputPrice": 0,
  953. "outputPrice": 2,
  954. "cacheReadsPrice": 0,
  955. "supportsImages": true,
  956. "supportsPromptCache": true
  957. },
  958. "gpt-5-nano-2025-08-07": {
  959. "maxTokens": 8192,
  960. "contextWindow": 272000,
  961. "inputPrice": 0,
  962. "outputPrice": 0,
  963. "cacheReadsPrice": 0,
  964. "supportsImages": true,
  965. "supportsPromptCache": true
  966. },
  967. "gpt-5-chat-latest": {
  968. "maxTokens": 8192,
  969. "contextWindow": 400000,
  970. "inputPrice": 1,
  971. "outputPrice": 10,
  972. "cacheReadsPrice": 0,
  973. "supportsImages": true,
  974. "supportsPromptCache": true
  975. },
  976. "o4-mini": {
  977. "maxTokens": 100000,
  978. "contextWindow": 200000,
  979. "inputPrice": 1,
  980. "outputPrice": 4,
  981. "cacheReadsPrice": 0,
  982. "supportsImages": true,
  983. "supportsPromptCache": true
  984. },
  985. "gpt-4.1": {
  986. "maxTokens": 32768,
  987. "contextWindow": 1047576,
  988. "inputPrice": 2,
  989. "outputPrice": 8,
  990. "cacheReadsPrice": 0,
  991. "supportsImages": true,
  992. "supportsPromptCache": true
  993. },
  994. "gpt-4.1-mini": {
  995. "maxTokens": 32768,
  996. "contextWindow": 1047576,
  997. "inputPrice": 0,
  998. "outputPrice": 1,
  999. "cacheReadsPrice": 0,
  1000. "supportsImages": true,
  1001. "supportsPromptCache": true
  1002. },
  1003. "gpt-4.1-nano": {
  1004. "maxTokens": 32768,
  1005. "contextWindow": 1047576,
  1006. "inputPrice": 0,
  1007. "outputPrice": 0,
  1008. "cacheReadsPrice": 0,
  1009. "supportsImages": true,
  1010. "supportsPromptCache": true
  1011. },
  1012. "o3-mini": {
  1013. "maxTokens": 100000,
  1014. "contextWindow": 200000,
  1015. "inputPrice": 1,
  1016. "outputPrice": 4,
  1017. "cacheReadsPrice": 0,
  1018. "supportsImages": false,
  1019. "supportsPromptCache": true
  1020. },
  1021. "o1-preview": {
  1022. "maxTokens": 32768,
  1023. "contextWindow": 128000,
  1024. "inputPrice": 15,
  1025. "outputPrice": 60,
  1026. "cacheReadsPrice": 7,
  1027. "supportsImages": true,
  1028. "supportsPromptCache": true
  1029. },
  1030. "o1-mini": {
  1031. "maxTokens": 65536,
  1032. "contextWindow": 128000,
  1033. "inputPrice": 1,
  1034. "outputPrice": 4,
  1035. "cacheReadsPrice": 0,
  1036. "supportsImages": true,
  1037. "supportsPromptCache": true
  1038. },
  1039. "gpt-4o": {
  1040. "maxTokens": 4096,
  1041. "contextWindow": 128000,
  1042. "inputPrice": 2,
  1043. "outputPrice": 10,
  1044. "cacheReadsPrice": 1,
  1045. "supportsImages": true,
  1046. "supportsPromptCache": true
  1047. },
  1048. "gpt-4o-mini": {
  1049. "maxTokens": 16384,
  1050. "contextWindow": 128000,
  1051. "inputPrice": 0,
  1052. "outputPrice": 0,
  1053. "cacheReadsPrice": 0,
  1054. "supportsImages": true,
  1055. "supportsPromptCache": true
  1056. },
  1057. "chatgpt-4o-latest": {
  1058. "maxTokens": 16384,
  1059. "contextWindow": 128000,
  1060. "inputPrice": 5,
  1061. "outputPrice": 15,
  1062. "supportsImages": true,
  1063. "supportsPromptCache": false
  1064. }
  1065. },
  1066. "xai": {
  1067. "grok-4-fast-reasoning": {
  1068. "maxTokens": 30000,
  1069. "contextWindow": 2000000,
  1070. "inputPrice": 0,
  1071. "outputPrice": 0,
  1072. "cacheReadsPrice": 0,
  1073. "supportsImages": true,
  1074. "supportsPromptCache": false,
  1075. "description": "xAI's Grok 4 Fast (free) multimodal model with 2M context."
  1076. },
  1077. "grok-4": {
  1078. "maxTokens": 8192,
  1079. "contextWindow": 262144,
  1080. "inputPrice": 3,
  1081. "outputPrice": 15,
  1082. "cacheReadsPrice": 0,
  1083. "supportsImages": true,
  1084. "supportsPromptCache": true
  1085. },
  1086. "grok-3-beta": {
  1087. "maxTokens": 8192,
  1088. "contextWindow": 131072,
  1089. "inputPrice": 3,
  1090. "outputPrice": 15,
  1091. "supportsImages": false,
  1092. "supportsPromptCache": true,
  1093. "description": "X AI's Grok-3 beta model with 131K context window"
  1094. },
  1095. "grok-3-fast-beta": {
  1096. "maxTokens": 8192,
  1097. "contextWindow": 131072,
  1098. "inputPrice": 5,
  1099. "outputPrice": 25,
  1100. "supportsImages": false,
  1101. "supportsPromptCache": true,
  1102. "description": "X AI's Grok-3 fast beta model with 131K context window"
  1103. },
  1104. "grok-3-mini-beta": {
  1105. "maxTokens": 8192,
  1106. "contextWindow": 131072,
  1107. "inputPrice": 0,
  1108. "outputPrice": 0,
  1109. "supportsImages": false,
  1110. "supportsPromptCache": true,
  1111. "description": "X AI's Grok-3 mini beta model with 131K context window"
  1112. },
  1113. "grok-3-mini-fast-beta": {
  1114. "maxTokens": 8192,
  1115. "contextWindow": 131072,
  1116. "inputPrice": 0,
  1117. "outputPrice": 4,
  1118. "supportsImages": false,
  1119. "supportsPromptCache": true,
  1120. "description": "X AI's Grok-3 mini fast beta model with 131K context window"
  1121. },
  1122. "grok-3": {
  1123. "maxTokens": 8192,
  1124. "contextWindow": 131072,
  1125. "inputPrice": 3,
  1126. "outputPrice": 15,
  1127. "supportsImages": false,
  1128. "supportsPromptCache": true,
  1129. "description": "X AI's Grok-3 model with 131K context window"
  1130. },
  1131. "grok-3-fast": {
  1132. "maxTokens": 8192,
  1133. "contextWindow": 131072,
  1134. "inputPrice": 5,
  1135. "outputPrice": 25,
  1136. "supportsImages": false,
  1137. "supportsPromptCache": true,
  1138. "description": "X AI's Grok-3 fast model with 131K context window"
  1139. },
  1140. "grok-3-mini": {
  1141. "maxTokens": 8192,
  1142. "contextWindow": 131072,
  1143. "inputPrice": 0,
  1144. "outputPrice": 0,
  1145. "supportsImages": false,
  1146. "supportsPromptCache": true,
  1147. "description": "X AI's Grok-3 mini model with 131K context window"
  1148. },
  1149. "grok-3-mini-fast": {
  1150. "maxTokens": 8192,
  1151. "contextWindow": 131072,
  1152. "inputPrice": 0,
  1153. "outputPrice": 4,
  1154. "supportsImages": false,
  1155. "supportsPromptCache": true,
  1156. "description": "X AI's Grok-3 mini fast model with 131K context window"
  1157. },
  1158. "grok-2-latest": {
  1159. "maxTokens": 8192,
  1160. "contextWindow": 131072,
  1161. "inputPrice": 2,
  1162. "outputPrice": 10,
  1163. "supportsImages": false,
  1164. "supportsPromptCache": false,
  1165. "description": "X AI's Grok-2 model - latest version with 131K context window"
  1166. },
  1167. "grok-2": {
  1168. "maxTokens": 8192,
  1169. "contextWindow": 131072,
  1170. "inputPrice": 2,
  1171. "outputPrice": 10,
  1172. "supportsImages": false,
  1173. "supportsPromptCache": false,
  1174. "description": "X AI's Grok-2 model with 131K context window"
  1175. },
  1176. "grok-2-1212": {
  1177. "maxTokens": 8192,
  1178. "contextWindow": 131072,
  1179. "inputPrice": 2,
  1180. "outputPrice": 10,
  1181. "supportsImages": false,
  1182. "supportsPromptCache": false,
  1183. "description": "X AI's Grok-2 model (version 1212) with 131K context window"
  1184. },
  1185. "grok-2-vision-latest": {
  1186. "maxTokens": 8192,
  1187. "contextWindow": 32768,
  1188. "inputPrice": 2,
  1189. "outputPrice": 10,
  1190. "supportsImages": true,
  1191. "supportsPromptCache": false,
  1192. "description": "X AI's Grok-2 Vision model - latest version with image support and 32K context window"
  1193. },
  1194. "grok-2-vision": {
  1195. "maxTokens": 8192,
  1196. "contextWindow": 32768,
  1197. "inputPrice": 2,
  1198. "outputPrice": 10,
  1199. "supportsImages": true,
  1200. "supportsPromptCache": false,
  1201. "description": "X AI's Grok-2 Vision model with image support and 32K context window"
  1202. },
  1203. "grok-2-vision-1212": {
  1204. "maxTokens": 8192,
  1205. "contextWindow": 32768,
  1206. "inputPrice": 2,
  1207. "outputPrice": 10,
  1208. "supportsImages": true,
  1209. "supportsPromptCache": false,
  1210. "description": "X AI's Grok-2 Vision model (version 1212) with image support and 32K context window"
  1211. },
  1212. "grok-vision-beta": {
  1213. "maxTokens": 8192,
  1214. "contextWindow": 8192,
  1215. "inputPrice": 5,
  1216. "outputPrice": 15,
  1217. "supportsImages": true,
  1218. "supportsPromptCache": false,
  1219. "description": "X AI's Grok Vision Beta model with image support and 8K context window"
  1220. },
  1221. "grok-beta": {
  1222. "maxTokens": 8192,
  1223. "contextWindow": 131072,
  1224. "inputPrice": 5,
  1225. "outputPrice": 15,
  1226. "supportsImages": false,
  1227. "supportsPromptCache": false,
  1228. "description": "X AI's Grok Beta model (legacy) with 131K context window"
  1229. }
  1230. },
  1231. "cerebras": {
  1232. "gpt-oss-120b": {
  1233. "maxTokens": 65536,
  1234. "contextWindow": 128000,
  1235. "inputPrice": 0,
  1236. "outputPrice": 0,
  1237. "supportsImages": false,
  1238. "supportsPromptCache": false,
  1239. "description": "Intelligent general purpose model with 3,000 tokens/s"
  1240. },
  1241. "qwen-3-coder-480b-free": {
  1242. "maxTokens": 40000,
  1243. "contextWindow": 64000,
  1244. "inputPrice": 0,
  1245. "outputPrice": 0,
  1246. "supportsImages": false,
  1247. "supportsPromptCache": false,
  1248. "description": "SOTA coding model with ~2000 tokens/s ($0 free tier)\\n\\n• Use this if you don't have a Cerebras subscription\\n• 64K context window\\n• Rate limits: 150K TPM, 1M TPH/TPD, 10 RPM, 100 RPH/RPD\\n\\nUpgrade for higher limits: [https://cloud.cerebras.ai/?utm=cline](https://cloud.cerebras.ai/?utm=cline)"
  1249. },
  1250. "qwen-3-coder-480b": {
  1251. "maxTokens": 40000,
  1252. "contextWindow": 128000,
  1253. "inputPrice": 0,
  1254. "outputPrice": 0,
  1255. "supportsImages": false,
  1256. "supportsPromptCache": false,
  1257. "description": "SOTA coding model with ~2000 tokens/s ($50/$250 paid tiers)\\n\\n• Use this if you have a Cerebras subscription\\n• 131K context window with higher rate limits"
  1258. },
  1259. "qwen-3-235b-a22b-instruct-2507": {
  1260. "maxTokens": 64000,
  1261. "contextWindow": 64000,
  1262. "inputPrice": 0,
  1263. "outputPrice": 0,
  1264. "supportsImages": false,
  1265. "supportsPromptCache": false,
  1266. "description": "Intelligent model with ~1400 tokens/s"
  1267. },
  1268. "llama-3.3-70b": {
  1269. "maxTokens": 64000,
  1270. "contextWindow": 64000,
  1271. "inputPrice": 0,
  1272. "outputPrice": 0,
  1273. "supportsImages": false,
  1274. "supportsPromptCache": false,
  1275. "description": "Powerful model with ~2600 tokens/s"
  1276. },
  1277. "qwen-3-32b": {
  1278. "maxTokens": 64000,
  1279. "contextWindow": 64000,
  1280. "inputPrice": 0,
  1281. "outputPrice": 0,
  1282. "supportsImages": false,
  1283. "supportsPromptCache": false,
  1284. "description": "SOTA coding performance with ~2500 tokens/s"
  1285. },
  1286. "qwen-3-235b-a22b-thinking-2507": {
  1287. "maxTokens": 32000,
  1288. "contextWindow": 65000,
  1289. "inputPrice": 0,
  1290. "outputPrice": 0,
  1291. "supportsImages": false,
  1292. "supportsPromptCache": false,
  1293. "description": "SOTA performance with ~1500 tokens/s"
  1294. }
  1295. },
  1296. "nousResearch": {
  1297. "Hermes-4-405B": {
  1298. "maxTokens": 8192,
  1299. "contextWindow": 128000,
  1300. "inputPrice": 0,
  1301. "outputPrice": 0,
  1302. "supportsImages": false,
  1303. "supportsPromptCache": false,
  1304. "description": "This is the largest model in the Hermes 4 family, and it is the fullest expression of our design, focused on advanced reasoning and creative depth rather than optimizing inference speed or cost."
  1305. },
  1306. "Hermes-4-70B": {
  1307. "maxTokens": 8192,
  1308. "contextWindow": 128000,
  1309. "inputPrice": 0,
  1310. "outputPrice": 0,
  1311. "supportsImages": false,
  1312. "supportsPromptCache": false,
  1313. "description": "This incarnation of Hermes 4 balances scale and size. It handles complex reasoning tasks, while staying fast and cost effective. A versatile choice for many use cases."
  1314. }
  1315. }
  1316. }`
  1317. // GetConfigFields returns all configuration fields
  1318. func GetConfigFields() ([]ConfigField, error) {
  1319. var fields []ConfigField
  1320. if err := json.Unmarshal([]byte(rawConfigFields), &fields); err != nil {
  1321. return nil, fmt.Errorf("failed to parse config fields: %w", err)
  1322. }
  1323. return fields, nil
  1324. }
  1325. // GetModelDefinitions returns all model definitions
  1326. func GetModelDefinitions() (map[string]map[string]ModelInfo, error) {
  1327. var models map[string]map[string]ModelInfo
  1328. if err := json.Unmarshal([]byte(rawModelDefinitions), &models); err != nil {
  1329. return nil, fmt.Errorf("failed to parse model definitions: %w", err)
  1330. }
  1331. return models, nil
  1332. }
  1333. // GetProviderDefinition returns the definition for a specific provider
  1334. func GetProviderDefinition(providerID string) (*ProviderDefinition, error) {
  1335. definitions, err := GetProviderDefinitions()
  1336. if err != nil {
  1337. return nil, err
  1338. }
  1339. def, exists := definitions[providerID]
  1340. if !exists {
  1341. return nil, fmt.Errorf("provider %s not found", providerID)
  1342. }
  1343. return &def, nil
  1344. }
  1345. // GetProviderDefinitions returns all provider definitions
  1346. func GetProviderDefinitions() (map[string]ProviderDefinition, error) {
  1347. configFields, err := GetConfigFields()
  1348. if err != nil {
  1349. return nil, err
  1350. }
  1351. modelDefinitions, err := GetModelDefinitions()
  1352. if err != nil {
  1353. return nil, err
  1354. }
  1355. definitions := make(map[string]ProviderDefinition)
  1356. // Anthropic (Claude)
  1357. definitions["anthropic"] = ProviderDefinition{
  1358. ID: "anthropic",
  1359. Name: "Anthropic (Claude)",
  1360. RequiredFields: getFieldsByProvider("anthropic", configFields, true),
  1361. OptionalFields: getFieldsByProvider("anthropic", configFields, false),
  1362. Models: modelDefinitions["anthropic"],
  1363. DefaultModelID: "claude-sonnet-4-5-20250929",
  1364. HasDynamicModels: false,
  1365. SetupInstructions: `Get your API key from https://console.anthropic.com/`,
  1366. }
  1367. // OpenRouter
  1368. definitions["openrouter"] = ProviderDefinition{
  1369. ID: "openrouter",
  1370. Name: "OpenRouter",
  1371. RequiredFields: getFieldsByProvider("openrouter", configFields, true),
  1372. OptionalFields: getFieldsByProvider("openrouter", configFields, false),
  1373. Models: modelDefinitions["openrouter"],
  1374. DefaultModelID: "",
  1375. HasDynamicModels: true,
  1376. SetupInstructions: `Get your API key from https://openrouter.ai/keys`,
  1377. }
  1378. // AWS Bedrock
  1379. definitions["bedrock"] = ProviderDefinition{
  1380. ID: "bedrock",
  1381. Name: "AWS Bedrock",
  1382. RequiredFields: getFieldsByProvider("bedrock", configFields, true),
  1383. OptionalFields: getFieldsByProvider("bedrock", configFields, false),
  1384. Models: modelDefinitions["bedrock"],
  1385. DefaultModelID: "anthropic.claude-sonnet-4-20250514-v1",
  1386. HasDynamicModels: false,
  1387. SetupInstructions: `Configure AWS credentials with Bedrock access permissions`,
  1388. }
  1389. // OpenAI Compatible
  1390. definitions["openai"] = ProviderDefinition{
  1391. ID: "openai",
  1392. Name: "OpenAI Compatible",
  1393. RequiredFields: getFieldsByProvider("openai", configFields, true),
  1394. OptionalFields: getFieldsByProvider("openai", configFields, false),
  1395. Models: modelDefinitions["openai"],
  1396. DefaultModelID: "",
  1397. HasDynamicModels: true,
  1398. SetupInstructions: `Get your API key from https://platform.openai.com/api-keys`,
  1399. }
  1400. // Ollama
  1401. definitions["ollama"] = ProviderDefinition{
  1402. ID: "ollama",
  1403. Name: "Ollama",
  1404. RequiredFields: getFieldsByProvider("ollama", configFields, true),
  1405. OptionalFields: getFieldsByProvider("ollama", configFields, false),
  1406. Models: modelDefinitions["ollama"],
  1407. DefaultModelID: "",
  1408. HasDynamicModels: true,
  1409. SetupInstructions: `Install Ollama locally and ensure it's running on the specified port`,
  1410. }
  1411. // Google Gemini
  1412. definitions["gemini"] = ProviderDefinition{
  1413. ID: "gemini",
  1414. Name: "Google Gemini",
  1415. RequiredFields: getFieldsByProvider("gemini", configFields, true),
  1416. OptionalFields: getFieldsByProvider("gemini", configFields, false),
  1417. Models: modelDefinitions["gemini"],
  1418. DefaultModelID: "gemini-2.5-pro",
  1419. HasDynamicModels: false,
  1420. SetupInstructions: `Get your API key from https://makersuite.google.com/app/apikey`,
  1421. }
  1422. // OpenAI
  1423. definitions["openai-native"] = ProviderDefinition{
  1424. ID: "openai-native",
  1425. Name: "OpenAI",
  1426. RequiredFields: getFieldsByProvider("openai-native", configFields, true),
  1427. OptionalFields: getFieldsByProvider("openai-native", configFields, false),
  1428. Models: modelDefinitions["openai-native"],
  1429. DefaultModelID: "gpt-5-chat-latest",
  1430. HasDynamicModels: true,
  1431. SetupInstructions: `Get your API key from your API provider`,
  1432. }
  1433. // X AI (Grok)
  1434. definitions["xai"] = ProviderDefinition{
  1435. ID: "xai",
  1436. Name: "X AI (Grok)",
  1437. RequiredFields: getFieldsByProvider("xai", configFields, true),
  1438. OptionalFields: getFieldsByProvider("xai", configFields, false),
  1439. Models: modelDefinitions["xai"],
  1440. DefaultModelID: "grok-4",
  1441. HasDynamicModels: false,
  1442. SetupInstructions: `Get your API key from https://console.x.ai/`,
  1443. }
  1444. // Cerebras
  1445. definitions["cerebras"] = ProviderDefinition{
  1446. ID: "cerebras",
  1447. Name: "Cerebras",
  1448. RequiredFields: getFieldsByProvider("cerebras", configFields, true),
  1449. OptionalFields: getFieldsByProvider("cerebras", configFields, false),
  1450. Models: modelDefinitions["cerebras"],
  1451. DefaultModelID: "qwen-3-coder-480b-free",
  1452. HasDynamicModels: false,
  1453. SetupInstructions: `Get your API key from https://cloud.cerebras.ai/`,
  1454. }
  1455. // Oca
  1456. definitions["oca"] = ProviderDefinition{
  1457. ID: "oca",
  1458. Name: "Oca",
  1459. RequiredFields: getFieldsByProvider("oca", configFields, true),
  1460. OptionalFields: getFieldsByProvider("oca", configFields, false),
  1461. Models: modelDefinitions["oca"],
  1462. DefaultModelID: "",
  1463. HasDynamicModels: false,
  1464. SetupInstructions: `Configure Oca API credentials`,
  1465. }
  1466. // NousResearch
  1467. definitions["nousResearch"] = ProviderDefinition{
  1468. ID: "nousResearch",
  1469. Name: "NousResearch",
  1470. RequiredFields: getFieldsByProvider("nousResearch", configFields, true),
  1471. OptionalFields: getFieldsByProvider("nousResearch", configFields, false),
  1472. Models: modelDefinitions["nousResearch"],
  1473. DefaultModelID: "Hermes-4-405B",
  1474. HasDynamicModels: false,
  1475. SetupInstructions: `Configure NousResearch API credentials`,
  1476. }
  1477. return definitions, nil
  1478. }
  1479. // IsValidProvider checks if a provider ID is valid
  1480. func IsValidProvider(providerID string) bool {
  1481. for _, p := range AllProviders {
  1482. if p == providerID {
  1483. return true
  1484. }
  1485. }
  1486. return false
  1487. }
  1488. // GetProviderDisplayName returns a human-readable name for a provider
  1489. func GetProviderDisplayName(providerID string) string {
  1490. displayNames := map[string]string{
  1491. "anthropic": "Anthropic (Claude)",
  1492. "openrouter": "OpenRouter",
  1493. "bedrock": "AWS Bedrock",
  1494. "openai": "OpenAI Compatible",
  1495. "ollama": "Ollama",
  1496. "gemini": "Google Gemini",
  1497. "openai-native": "OpenAI",
  1498. "xai": "X AI (Grok)",
  1499. "cerebras": "Cerebras",
  1500. "oca": "Oca",
  1501. "nousResearch": "NousResearch",
  1502. }
  1503. if name, exists := displayNames[providerID]; exists {
  1504. return name
  1505. }
  1506. return providerID
  1507. }
  1508. // getFieldsByProvider filters configuration fields by provider and requirement
  1509. // Uses category field as primary filter with override support
  1510. func getFieldsByProvider(providerID string, allFields []ConfigField, required bool) []ConfigField {
  1511. var fields []ConfigField
  1512. for _, field := range allFields {
  1513. fieldName := strings.ToLower(field.Name)
  1514. fieldCategory := strings.ToLower(field.Category)
  1515. providerName := strings.ToLower(providerID)
  1516. isRelevant := false
  1517. // Priority 1: Check manual overrides FIRST (from GetFieldOverride in this package)
  1518. if override, hasOverride := GetFieldOverride(providerID, field.Name); hasOverride {
  1519. isRelevant = override
  1520. } else if fieldCategory == providerName {
  1521. // Priority 2: Direct category match (primary filtering mechanism)
  1522. isRelevant = true
  1523. } else if fieldCategory == "aws" && providerID == "bedrock" {
  1524. // Priority 3: Handle provider-specific category relationships
  1525. // AWS fields are used by Bedrock provider
  1526. isRelevant = true
  1527. } else if fieldCategory == "openai" && providerID == "openai-native" {
  1528. // OpenAI fields used by openai-native
  1529. isRelevant = true
  1530. } else if fieldCategory == "general" {
  1531. // Priority 4: Universal fields that apply to all providers
  1532. // Note: ulid is excluded as it's auto-generated and users should not set it
  1533. universalFields := []string{"requesttimeoutms", "clineaccountid"}
  1534. for _, universal := range universalFields {
  1535. if fieldName == universal {
  1536. isRelevant = true
  1537. break
  1538. }
  1539. }
  1540. }
  1541. if isRelevant && field.Required == required {
  1542. fields = append(fields, field)
  1543. }
  1544. }
  1545. return fields
  1546. }