Răsfoiți Sursa

CLI - Fix OpenAI Provider Definition

CLI - Fix OpenAI Provider Definition
Catriel Müller 3 luni în urmă
părinte
comite
c49afca426

+ 5 - 0
.changeset/easy-dragons-speak.md

@@ -0,0 +1,5 @@
+---
+"@kilocode/cli": patch
+---
+
+Fix OpenAI compatible provider config

+ 100 - 2
cli/docs/PROVIDER_CONFIGURATION.md

@@ -38,6 +38,7 @@ This guide provides detailed information on how to configure each provider in Ki
     - [Qwen Code](#qwen-code)
     - [Gemini CLI](#gemini-cli)
     - [ZAI](#zai)
+    - [Minimax](#minimax)
     - [Unbound](#unbound)
     - [Requesty](#requesty)
     - [Roo](#roo)
@@ -46,6 +47,8 @@ This guide provides detailed information on how to configure each provider in Ki
     - [Human Relay](#human-relay)
     - [Fake AI](#fake-ai)
     - [OVHcloud AI Endpoints](#ovhcloud-ai-endpoints)
+    - [Inception](#inception)
+    - [Synthetic](#synthetic)
 
 ## Introduction
 
@@ -634,7 +637,7 @@ OpenAI API integration (alternative configuration).
 **Required Fields**:
 
 - `openAiApiKey` (password): Your OpenAI API key
-- `apiModelId` (text): The model to use (default: `gpt-4o`)
+- `openAiModelId` (text): The model to use (default: `gpt-4o`)
 
 **Optional Fields**:
 
@@ -647,7 +650,7 @@ OpenAI API integration (alternative configuration).
 	"id": "default",
 	"provider": "openai",
 	"openAiApiKey": "sk-...",
-	"apiModelId": "gpt-4o",
+	"openAiModelId": "gpt-4o",
 	"openAiBaseUrl": ""
 }
 ```
@@ -1358,6 +1361,101 @@ OVHcloud AI Endpoints inference provider.
 
 ---
 
+### inception
+
+Inception Labs AI platform.
+
+**Description**: Access AI models through the Inception Labs platform.
+
+**Required Fields**:
+
+- `inceptionLabsApiKey` (password): Your Inception Labs API key
+- `inceptionLabsModelId` (text): Model identifier (default: `gpt-4o`)
+
+**Optional Fields**:
+
+- `inceptionLabsBaseUrl` (text): Custom base URL (leave empty for default)
+
+**Example Configuration**:
+
+```json
+{
+	"id": "default",
+	"provider": "inception",
+	"inceptionLabsApiKey": "...",
+	"inceptionLabsModelId": "gpt-4o",
+	"inceptionLabsBaseUrl": ""
+}
+```
+
+**Default Model**: `gpt-4o`
+
+**Notes**:
+
+- Get your API key from Inception Labs platform
+- Supports various AI models
+
+---
+
+### synthetic
+
+Synthetic AI provider.
+
+**Description**: Access AI models through the Synthetic platform.
+
+**Required Fields**:
+
+- `syntheticApiKey` (password): Your Synthetic API key
+- `apiModelId` (text): Model identifier (default: `synthetic-model`)
+
+**Example Configuration**:
+
+```json
+{
+	"id": "default",
+	"provider": "synthetic",
+	"syntheticApiKey": "...",
+	"apiModelId": "synthetic-model"
+}
+```
+
+**Default Model**: `synthetic-model`
+
+---
+
+### minimax
+
+MiniMax AI platform.
+
+**Description**: Access MiniMax's AI models.
+
+**Required Fields**:
+
+- `minimaxApiKey` (password): Your MiniMax API key
+- `minimaxBaseUrl` (text): MiniMax API base URL (default: `https://api.minimax.io/anthropic`)
+- `apiModelId` (text): The model to use (default: `MiniMax-M2`)
+
+**Example Configuration**:
+
+```json
+{
+	"id": "default",
+	"provider": "minimax",
+	"minimaxBaseUrl": "https://api.minimax.io/anthropic",
+	"minimaxApiKey": "...",
+	"apiModelId": "MiniMax-M2"
+}
+```
+
+**Default Model**: `MiniMax-M2`
+
+**Notes**:
+
+- Supports both `.io` and `.com` domains
+- Uses Anthropic-compatible API format
+
+---
+
 ## Additional Resources
 
 - [Kilo Code Documentation](https://docs.kilocode.com/)

+ 3 - 2
cli/src/config/mapper.ts

@@ -74,7 +74,7 @@ function getModelIdForProvider(provider: ProviderConfig): string {
 		case "lmstudio":
 			return provider.lmStudioModelId || ""
 		case "openai":
-			return provider.apiModelId || ""
+			return provider.openAiModelId || ""
 		case "glama":
 			return provider.glamaModelId || ""
 		case "litellm":
@@ -114,8 +114,9 @@ function getModelIdForProvider(provider: ProviderConfig): string {
 		case "roo":
 		case "claude-code":
 		case "synthetic":
-		case "virtual-quota-fallback":
 			return provider.apiModelId || ""
+		case "virtual-quota-fallback":
+			return provider.profiles && provider.profiles.length > 0 ? `${provider.profiles.length} profile(s)` : ""
 		case "vscode-lm":
 			if (provider.vsCodeLmModelSelector) {
 				return `${provider.vsCodeLmModelSelector.vendor}/${provider.vsCodeLmModelSelector.family}`

+ 115 - 2
cli/src/config/schema.json

@@ -265,7 +265,9 @@
 						"virtual-quota-fallback",
 						"human-relay",
 						"fake-ai",
-						"ovhcloud"
+						"ovhcloud",
+						"inception",
+						"synthetic"
 					]
 				}
 			},
@@ -982,7 +984,10 @@
 								"description": "OpenAI API key"
 							},
 							"openAiBaseUrl": { "type": "string" },
-							"apiModelId": { "type": "string" }
+							"openAiModelId": {
+								"type": "string",
+								"description": "OpenAI model ID"
+							}
 						}
 					}
 				},
@@ -1000,6 +1005,20 @@
 						}
 					}
 				},
+				{
+					"if": {
+						"properties": {
+							"provider": { "const": "openai" },
+							"openAiModelId": { "type": "string", "minLength": 1 }
+						},
+						"required": ["openAiModelId"]
+					},
+					"then": {
+						"properties": {
+							"openAiModelId": { "minLength": 1 }
+						}
+					}
+				},
 				{
 					"if": {
 						"properties": { "provider": { "const": "cerebras" } }
@@ -2172,6 +2191,100 @@
 							"ovhCloudAiEndpointsModelId": { "minLength": 1 }
 						}
 					}
+				},
+				{
+					"if": {
+						"properties": { "provider": { "const": "inception" } }
+					},
+					"then": {
+						"properties": {
+							"inceptionLabsApiKey": {
+								"type": "string",
+								"description": "Inception Labs API key"
+							},
+							"inceptionLabsBaseUrl": {
+								"type": "string",
+								"description": "Inception Labs base URL"
+							},
+							"inceptionLabsModelId": {
+								"type": "string",
+								"description": "Inception Labs model ID"
+							}
+						}
+					}
+				},
+				{
+					"if": {
+						"properties": {
+							"provider": { "const": "inception" },
+							"inceptionLabsApiKey": { "type": "string", "minLength": 1 }
+						},
+						"required": ["inceptionLabsApiKey"]
+					},
+					"then": {
+						"properties": {
+							"inceptionLabsApiKey": { "minLength": 10 }
+						}
+					}
+				},
+				{
+					"if": {
+						"properties": {
+							"provider": { "const": "inception" },
+							"inceptionLabsModelId": { "type": "string", "minLength": 1 }
+						},
+						"required": ["inceptionLabsModelId"]
+					},
+					"then": {
+						"properties": {
+							"inceptionLabsModelId": { "minLength": 1 }
+						}
+					}
+				},
+				{
+					"if": {
+						"properties": { "provider": { "const": "synthetic" } }
+					},
+					"then": {
+						"properties": {
+							"syntheticApiKey": {
+								"type": "string",
+								"description": "Synthetic API key"
+							},
+							"apiModelId": {
+								"type": "string",
+								"description": "Synthetic model ID"
+							}
+						}
+					}
+				},
+				{
+					"if": {
+						"properties": {
+							"provider": { "const": "synthetic" },
+							"syntheticApiKey": { "type": "string", "minLength": 1 }
+						},
+						"required": ["syntheticApiKey"]
+					},
+					"then": {
+						"properties": {
+							"syntheticApiKey": { "minLength": 10 }
+						}
+					}
+				},
+				{
+					"if": {
+						"properties": {
+							"provider": { "const": "synthetic" },
+							"apiModelId": { "type": "string", "minLength": 1 }
+						},
+						"required": ["apiModelId"]
+					},
+					"then": {
+						"properties": {
+							"apiModelId": { "minLength": 1 }
+						}
+					}
 				}
 			]
 		}

+ 114 - 3
cli/src/config/types.ts

@@ -117,171 +117,266 @@ type KilocodeProviderConfig = BaseProviderConfig & {
 	kilocodeModel?: string
 	kilocodeToken?: string
 	kilocodeOrganizationId?: string
+	openRouterSpecificProvider?: string
+	openRouterProviderDataCollection?: "allow" | "deny"
+	openRouterProviderSort?: "price" | "throughput" | "latency"
+	openRouterZdr?: boolean
+	kilocodeTesterWarningsDisabledUntil?: number
 }
 
 type AnthropicProviderConfig = BaseProviderConfig & {
 	provider: "anthropic"
 	apiModelId?: string
+	apiKey?: string
+	anthropicBaseUrl?: string
+	anthropicUseAuthToken?: boolean
+	anthropicBeta1MContext?: boolean
 }
 
 type OpenAINativeProviderConfig = BaseProviderConfig & {
 	provider: "openai-native"
 	apiModelId?: string
+	openAiNativeApiKey?: string
+	openAiNativeBaseUrl?: string
+	openAiNativeServiceTier?: "auto" | "default" | "flex" | "priority"
 }
 
 type OpenAIProviderConfig = BaseProviderConfig & {
 	provider: "openai"
-	apiModelId?: string
+	openAiModelId?: string
+	openAiBaseUrl?: string
+	openAiApiKey?: string
+	openAiLegacyFormat?: boolean
+	openAiR1FormatEnabled?: boolean
+	openAiUseAzure?: boolean
+	azureApiVersion?: string
+	openAiStreamingEnabled?: boolean
+	openAiHeaders?: Record<string, string>
 }
 
 type OpenRouterProviderConfig = BaseProviderConfig & {
 	provider: "openrouter"
 	openRouterModelId?: string
+	openRouterApiKey?: string
+	openRouterBaseUrl?: string
+	openRouterSpecificProvider?: string
+	openRouterUseMiddleOutTransform?: boolean
+	openRouterProviderDataCollection?: "allow" | "deny"
+	openRouterProviderSort?: "price" | "throughput" | "latency"
+	openRouterZdr?: boolean
 }
 
 type OllamaProviderConfig = BaseProviderConfig & {
 	provider: "ollama"
 	ollamaModelId?: string
+	ollamaBaseUrl?: string
+	ollamaApiKey?: string
+	ollamaNumCtx?: number
 }
 
 type LMStudioProviderConfig = BaseProviderConfig & {
 	provider: "lmstudio"
 	lmStudioModelId?: string
+	lmStudioBaseUrl?: string
+	lmStudioDraftModelId?: string
+	lmStudioSpeculativeDecodingEnabled?: boolean
 }
 
 type GlamaProviderConfig = BaseProviderConfig & {
 	provider: "glama"
 	glamaModelId?: string
+	glamaApiKey?: string
 }
 
 type LiteLLMProviderConfig = BaseProviderConfig & {
 	provider: "litellm"
 	litellmModelId?: string
+	litellmBaseUrl?: string
+	litellmApiKey?: string
+	litellmUsePromptCache?: boolean
 }
 
 type DeepInfraProviderConfig = BaseProviderConfig & {
 	provider: "deepinfra"
 	deepInfraModelId?: string
+	deepInfraBaseUrl?: string
+	deepInfraApiKey?: string
 }
 
 type UnboundProviderConfig = BaseProviderConfig & {
 	provider: "unbound"
 	unboundModelId?: string
+	unboundApiKey?: string
 }
 
 type RequestyProviderConfig = BaseProviderConfig & {
 	provider: "requesty"
 	requestyModelId?: string
+	requestyBaseUrl?: string
+	requestyApiKey?: string
 }
 
 type VercelAiGatewayProviderConfig = BaseProviderConfig & {
 	provider: "vercel-ai-gateway"
 	vercelAiGatewayModelId?: string
+	vercelAiGatewayApiKey?: string
 }
 
 type IOIntelligenceProviderConfig = BaseProviderConfig & {
 	provider: "io-intelligence"
 	ioIntelligenceModelId?: string
+	ioIntelligenceApiKey?: string
 }
 
 type OVHCloudProviderConfig = BaseProviderConfig & {
 	provider: "ovhcloud"
 	ovhCloudAiEndpointsModelId?: string
+	ovhCloudAiEndpointsApiKey?: string
+	ovhCloudAiEndpointsBaseUrl?: string
 }
 
 type InceptionProviderConfig = BaseProviderConfig & {
 	provider: "inception"
 	inceptionLabsModelId?: string
+	inceptionLabsBaseUrl?: string
+	inceptionLabsApiKey?: string
 }
 
 type BedrockProviderConfig = BaseProviderConfig & {
 	provider: "bedrock"
 	apiModelId?: string
+	awsAccessKey?: string
+	awsSecretKey?: string
+	awsSessionToken?: string
+	awsRegion?: string
+	awsUseCrossRegionInference?: boolean
+	awsUsePromptCache?: boolean
+	awsProfile?: string
+	awsUseProfile?: boolean
+	awsApiKey?: string
+	awsUseApiKey?: boolean
+	awsCustomArn?: string
+	awsModelContextWindow?: number
+	awsBedrockEndpointEnabled?: boolean
+	awsBedrockEndpoint?: string
+	awsBedrock1MContext?: boolean
 }
 
 type VertexProviderConfig = BaseProviderConfig & {
 	provider: "vertex"
 	apiModelId?: string
+	vertexKeyFile?: string
+	vertexJsonCredentials?: string
+	vertexProjectId?: string
+	vertexRegion?: string
+	enableUrlContext?: boolean
+	enableGrounding?: boolean
 }
 
 type GeminiProviderConfig = BaseProviderConfig & {
 	provider: "gemini"
 	apiModelId?: string
+	geminiApiKey?: string
+	googleGeminiBaseUrl?: string
+	enableUrlContext?: boolean
+	enableGrounding?: boolean
 }
 
 type GeminiCliProviderConfig = BaseProviderConfig & {
 	provider: "gemini-cli"
 	apiModelId?: string
+	geminiCliOAuthPath?: string
+	geminiCliProjectId?: string
 }
 
 type MistralProviderConfig = BaseProviderConfig & {
 	provider: "mistral"
 	apiModelId?: string
+	mistralApiKey?: string
+	mistralCodestralUrl?: string
 }
 
 type MoonshotProviderConfig = BaseProviderConfig & {
 	provider: "moonshot"
 	apiModelId?: string
+	moonshotBaseUrl?: string
+	moonshotApiKey?: string
 }
 
 type MinimaxProviderConfig = BaseProviderConfig & {
 	provider: "minimax"
 	apiModelId?: string
+	minimaxBaseUrl?: string
+	minimaxApiKey?: string
 }
 
 type DeepSeekProviderConfig = BaseProviderConfig & {
 	provider: "deepseek"
 	apiModelId?: string
+	deepSeekBaseUrl?: string
+	deepSeekApiKey?: string
 }
 
 type DoubaoProviderConfig = BaseProviderConfig & {
 	provider: "doubao"
 	apiModelId?: string
+	doubaoBaseUrl?: string
+	doubaoApiKey?: string
 }
 
 type QwenCodeProviderConfig = BaseProviderConfig & {
 	provider: "qwen-code"
 	apiModelId?: string
+	qwenCodeOauthPath?: string
 }
 
 type XAIProviderConfig = BaseProviderConfig & {
 	provider: "xai"
 	apiModelId?: string
+	xaiApiKey?: string
 }
 
 type GroqProviderConfig = BaseProviderConfig & {
 	provider: "groq"
 	apiModelId?: string
+	groqApiKey?: string
 }
 
 type ChutesProviderConfig = BaseProviderConfig & {
 	provider: "chutes"
 	apiModelId?: string
+	chutesApiKey?: string
 }
 
 type CerebrasProviderConfig = BaseProviderConfig & {
 	provider: "cerebras"
 	apiModelId?: string
+	cerebrasApiKey?: string
 }
 
 type SambaNovaProviderConfig = BaseProviderConfig & {
 	provider: "sambanova"
 	apiModelId?: string
+	sambaNovaApiKey?: string
 }
 
 type ZAIProviderConfig = BaseProviderConfig & {
 	provider: "zai"
 	apiModelId?: string
+	zaiApiKey?: string
+	zaiApiLine?: "international_coding" | "china_coding"
 }
 
 type FireworksProviderConfig = BaseProviderConfig & {
 	provider: "fireworks"
 	apiModelId?: string
+	fireworksApiKey?: string
 }
 
 type FeatherlessProviderConfig = BaseProviderConfig & {
 	provider: "featherless"
 	apiModelId?: string
+	featherlessApiKey?: string
 }
 
 type RooProviderConfig = BaseProviderConfig & {
@@ -292,6 +387,8 @@ type RooProviderConfig = BaseProviderConfig & {
 type ClaudeCodeProviderConfig = BaseProviderConfig & {
 	provider: "claude-code"
 	apiModelId?: string
+	claudeCodePath?: string
+	claudeCodeMaxOutputTokens?: number
 }
 
 type VSCodeLMProviderConfig = BaseProviderConfig & {
@@ -307,16 +404,30 @@ type VSCodeLMProviderConfig = BaseProviderConfig & {
 type HuggingFaceProviderConfig = BaseProviderConfig & {
 	provider: "huggingface"
 	huggingFaceModelId?: string
+	huggingFaceApiKey?: string
+	huggingFaceInferenceProvider?: string
 }
 
 type SyntheticProviderConfig = BaseProviderConfig & {
 	provider: "synthetic"
 	apiModelId?: string
+	syntheticApiKey?: string
 }
 
 type VirtualQuotaFallbackProviderConfig = BaseProviderConfig & {
 	provider: "virtual-quota-fallback"
-	apiModelId?: string
+	profiles?: Array<{
+		profileName?: string
+		profileId?: string
+		profileLimits?: {
+			tokensPerMinute?: number
+			tokensPerHour?: number
+			tokensPerDay?: number
+			requestsPerMinute?: number
+			requestsPerHour?: number
+			requestsPerDay?: number
+		}
+	}>
 }
 
 type HumanRelayProviderConfig = BaseProviderConfig & {
@@ -326,7 +437,7 @@ type HumanRelayProviderConfig = BaseProviderConfig & {
 
 type FakeAIProviderConfig = BaseProviderConfig & {
 	provider: "fake-ai"
-	// No model ID field
+	fakeAi?: unknown
 }
 
 // Discriminated union of all provider configs

+ 45 - 0
cli/src/constants/providers/settings.ts

@@ -475,6 +475,37 @@ export const FIELD_REGISTRY: Record<string, FieldMetadata> = {
 		type: "text",
 		placeholder: "Enter model ID...",
 	},
+	ovhCloudAiEndpointsBaseUrl: {
+		label: "Base URL",
+		type: "text",
+		placeholder: "Enter base URL (or leave empty for default)...",
+		isOptional: true,
+	},
+
+	// Inception Labs fields
+	inceptionLabsApiKey: {
+		label: "API Key",
+		type: "password",
+		placeholder: "Enter Inception Labs API key...",
+	},
+	inceptionLabsBaseUrl: {
+		label: "Base URL",
+		type: "text",
+		placeholder: "Enter base URL (or leave empty for default)...",
+		isOptional: true,
+	},
+	inceptionLabsModelId: {
+		label: "Model ID",
+		type: "text",
+		placeholder: "Enter model ID...",
+	},
+
+	// Synthetic fields
+	syntheticApiKey: {
+		label: "API Key",
+		type: "password",
+		placeholder: "Enter Synthetic API key...",
+	},
 
 	// Virtual Quota Fallback fields
 	profiles: {
@@ -812,6 +843,20 @@ export const getProviderSettings = (provider: ProviderName, config: ProviderSett
 			return [
 				createFieldConfig("ovhCloudAiEndpointsApiKey", config),
 				createFieldConfig("ovhCloudAiEndpointsModelId", config, "gpt-oss-120b"),
+				createFieldConfig("ovhCloudAiEndpointsBaseUrl", config, "Default"),
+			]
+
+		case "inception":
+			return [
+				createFieldConfig("inceptionLabsApiKey", config),
+				createFieldConfig("inceptionLabsBaseUrl", config, "Default"),
+				createFieldConfig("inceptionLabsModelId", config, "gpt-4o"),
+			]
+
+		case "synthetic":
+			return [
+				createFieldConfig("syntheticApiKey", config),
+				createFieldConfig("apiModelId", config, "synthetic-model"),
 			]
 
 		default: