claude-code-router/examples/dynamic-preset-example.json
o.akimov 5d515a7bd9 refactor: localize codebase by translating all comments to English
feat: improve OpenAI API handling borrowig functionality from y-router and claude-code-proxy
2026-04-24 23:14:13 +02:00

246 lines
5.8 KiB
JSON

{
"metadata": {
"name": "multi-provider-preset",
"version": "1.0.0",
"description": "Example preset: supports multi-provider selection and dynamic configuration",
"author": "CCR Team",
"keywords": ["example", "multi-provider", "dynamic"],
"ccrVersion": "2.0.0"
},
"schema": [
{
"id": "providerChoice",
"type": "select",
"label": "Select Provider",
"prompt": "Please select the LLM provider to use",
"options": {
"type": "static",
"options": [
{
"label": "OpenAI",
"value": "openai",
"description": "Use OpenAI's GPT models"
},
{
"label": "DeepSeek",
"value": "deepseek",
"description": "Use DeepSeek's cost-effective models"
},
{
"label": "Gemini",
"value": "gemini",
"description": "Use Google's Gemini models"
}
]
},
"required": true,
"defaultValue": "openai"
},
{
"id": "apiKey",
"type": "password",
"label": "API Key",
"prompt": "Please enter your API Key",
"placeholder": "sk-...",
"required": true,
"when": {
"field": "providerChoice",
"operator": "exists"
}
},
{
"id": "baseUrl",
"type": "input",
"label": "Base URL (Optional)",
"prompt": "Custom API Base URL, leave blank to use default",
"required": false,
"when": {
"field": "providerChoice",
"operator": "exists"
}
},
{
"id": "modelChoice",
"type": "select",
"label": "Select Model",
"prompt": "Please select the model to use",
"options": {
"type": "static",
"options": [
{
"label": "GPT-4o",
"value": "gpt-4o"
},
{
"label": "GPT-4o-mini",
"value": "gpt-4o-mini"
},
{
"label": "GPT-3.5-turbo",
"value": "gpt-3.5-turbo"
}
]
},
"required": true,
"when": {
"field": "providerChoice",
"operator": "eq",
"value": "openai"
},
"defaultValue": "gpt-4o"
},
{
"id": "deepseekModelChoice",
"type": "select",
"label": "Select Model",
"prompt": "Please select the DeepSeek model to use",
"options": {
"type": "static",
"options": [
{
"label": "DeepSeek-V3",
"value": "deepseek-v3"
},
{
"label": "DeepSeek-Chat",
"value": "deepseek-chat"
}
]
},
"required": true,
"when": {
"field": "providerChoice",
"operator": "eq",
"value": "deepseek"
},
"defaultValue": "deepseek-v3"
},
{
"id": "useProxy",
"type": "confirm",
"label": "Use Proxy",
"prompt": "Do you want to access the API via proxy?",
"defaultValue": false
},
{
"id": "proxyUrl",
"type": "input",
"label": "Proxy URL",
"prompt": "Please enter the proxy address (e.g., http://127.0.0.1:7890)",
"placeholder": "http://127.0.0.1:7890",
"required": true,
"when": {
"field": "useProxy",
"operator": "eq",
"value": true
}
},
{
"id": "maxTokens",
"type": "number",
"label": "Max Tokens",
"prompt": "Set the maximum token count for a single request",
"min": 100,
"max": 128000,
"defaultValue": 4096,
"required": false
},
{
"id": "advancedSettings",
"type": "confirm",
"label": "Advanced Settings",
"prompt": "Do you want to configure advanced options?",
"defaultValue": false
},
{
"id": "temperature",
"type": "number",
"label": "Temperature",
"prompt": "Control generation randomness (0-2)",
"min": 0,
"max": 2,
"defaultValue": 0.7,
"required": false,
"when": {
"field": "advancedSettings",
"operator": "eq",
"value": true
}
},
{
"id": "features",
"type": "multiselect",
"label": "Enable Features",
"prompt": "Select features to enable",
"options": {
"type": "static",
"options": [
{
"label": "Streaming Output",
"value": "stream"
},
{
"label": "Tool Calls",
"value": "tools"
},
{
"label": "Long Context Support",
"value": "longContext"
}
]
},
"defaultValue": ["stream"],
"required": false
}
],
"template": {
"Providers": [
{
"name": "{{providerChoice}}",
"api_base_url": "{{baseUrl}}",
"api_key": "{{apiKey}}",
"models": ["{{modelChoice}}", "{{deepseekModelChoice}}"]
}
],
"Router": {
"default": "{{providerChoice}}/{{modelChoice}}{{deepseekModelChoice}}"
},
"PROXY_URL": "{{proxyUrl}}",
"API_TIMEOUT_MS": 60000
},
"configMappings": [
{
"target": "Providers[0].name",
"value": "{{providerChoice}}"
},
{
"target": "Providers[0].api_key",
"value": "{{apiKey}}"
},
{
"target": "Providers[0].api_base_url",
"value": "{{baseUrl}}",
"when": {
"field": "baseUrl",
"operator": "exists"
}
},
{
"target": "Router.default",
"value": "{{providerChoice}}/{{modelChoice}}{{deepseekModelChoice}}"
},
{
"target": "PROXY_URL",
"value": "{{proxyUrl}}",
"when": {
"field": "useProxy",
"operator": "eq",
"value": true
}
},
{
"target": "API_TIMEOUT_MS",
"value": 60000
}
]
}