@caretive/caret-cli 0.0.1

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