refactor(config): restructure and uncomment example configuration

This commit is contained in:
hkfires
2025-12-03 10:29:36 +08:00
parent 8b13c91132
commit 559b7df404

View File

@@ -55,141 +55,130 @@ quota-exceeded:
# When true, enable authentication for the WebSocket API (/v1/ws). # When true, enable authentication for the WebSocket API (/v1/ws).
ws-auth: false ws-auth: false
# Amp CLI Integration # Gemini API keys
# Configure upstream URL for Amp CLI OAuth and management features gemini-api-key:
#amp-upstream-url: "https://ampcode.com" - api-key: "AIzaSy...01"
base-url: "https://generativelanguage.googleapis.com"
# Optional: Override API key for Amp upstream (otherwise uses env or file) headers:
#amp-upstream-api-key: "" X-Custom-Header: "custom-value"
proxy-url: "socks5://proxy.example.com:1080"
# Restrict Amp management routes (/api/auth, /api/user, etc.) to localhost only (recommended) excluded-models:
#amp-restrict-management-to-localhost: true - "gemini-2.5-pro" # exclude specific models from this provider (exact match)
- "gemini-2.5-*" # wildcard matching prefix (e.g. gemini-2.5-flash, gemini-2.5-pro)
# Amp Model Mappings - "*-preview" # wildcard matching suffix (e.g. gemini-3-pro-preview)
# Route unavailable Amp models to alternative models available in your local proxy. - "*flash*" # wildcard matching substring (e.g. gemini-2.5-flash-lite)
# Useful when Amp CLI requests models you don't have access to (e.g., Claude Opus 4.5) - api-key: "AIzaSy...02"
# but you have a similar model available (e.g., Claude Sonnet 4).
#amp-model-mappings:
# - from: "claude-opus-4.5" # Model requested by Amp CLI
# to: "claude-sonnet-4" # Route to this available model instead
# - from: "gpt-5"
# to: "gemini-2.5-pro"
# - from: "claude-3-opus-20240229"
# to: "claude-3-5-sonnet-20241022"
# Gemini API keys (preferred)
#gemini-api-key:
# - api-key: "AIzaSy...01"
# base-url: "https://generativelanguage.googleapis.com"
# headers:
# X-Custom-Header: "custom-value"
# proxy-url: "socks5://proxy.example.com:1080"
# excluded-models:
# - "gemini-2.5-pro" # exclude specific models from this provider (exact match)
# - "gemini-2.5-*" # wildcard matching prefix (e.g. gemini-2.5-flash, gemini-2.5-pro)
# - "*-preview" # wildcard matching suffix (e.g. gemini-3-pro-preview)
# - "*flash*" # wildcard matching substring (e.g. gemini-2.5-flash-lite)
# - api-key: "AIzaSy...02"
# API keys for official Generative Language API (legacy compatibility)
#generative-language-api-key:
# - "AIzaSy...01"
# - "AIzaSy...02"
# Codex API keys # Codex API keys
#codex-api-key: codex-api-key:
# - api-key: "sk-atSM..." - api-key: "sk-atSM..."
# base-url: "https://www.example.com" # use the custom codex API endpoint base-url: "https://www.example.com" # use the custom codex API endpoint
# headers: headers:
# X-Custom-Header: "custom-value" X-Custom-Header: "custom-value"
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
# excluded-models: excluded-models:
# - "gpt-5.1" # exclude specific models (exact match) - "gpt-5.1" # exclude specific models (exact match)
# - "gpt-5-*" # wildcard matching prefix (e.g. gpt-5-medium, gpt-5-codex) - "gpt-5-*" # wildcard matching prefix (e.g. gpt-5-medium, gpt-5-codex)
# - "*-mini" # wildcard matching suffix (e.g. gpt-5-codex-mini) - "*-mini" # wildcard matching suffix (e.g. gpt-5-codex-mini)
# - "*codex*" # wildcard matching substring (e.g. gpt-5-codex-low) - "*codex*" # wildcard matching substring (e.g. gpt-5-codex-low)
# Claude API keys # Claude API keys
#claude-api-key: claude-api-key:
# - api-key: "sk-atSM..." # use the official claude API key, no need to set the base url - api-key: "sk-atSM..." # use the official claude API key, no need to set the base url
# - api-key: "sk-atSM..." - api-key: "sk-atSM..."
# base-url: "https://www.example.com" # use the custom claude API endpoint base-url: "https://www.example.com" # use the custom claude API endpoint
# headers: headers:
# X-Custom-Header: "custom-value" X-Custom-Header: "custom-value"
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
# models: models:
# - name: "claude-3-5-sonnet-20241022" # upstream model name - name: "claude-3-5-sonnet-20241022" # upstream model name
# alias: "claude-sonnet-latest" # client alias mapped to the upstream model alias: "claude-sonnet-latest" # client alias mapped to the upstream model
# excluded-models: excluded-models:
# - "claude-opus-4-5-20251101" # exclude specific models (exact match) - "claude-opus-4-5-20251101" # exclude specific models (exact match)
# - "claude-3-*" # wildcard matching prefix (e.g. claude-3-7-sonnet-20250219) - "claude-3-*" # wildcard matching prefix (e.g. claude-3-7-sonnet-20250219)
# - "*-think" # wildcard matching suffix (e.g. claude-opus-4-5-thinking) - "*-think" # wildcard matching suffix (e.g. claude-opus-4-5-thinking)
# - "*haiku*" # wildcard matching substring (e.g. claude-3-5-haiku-20241022) - "*haiku*" # wildcard matching substring (e.g. claude-3-5-haiku-20241022)
# OpenAI compatibility providers # OpenAI compatibility providers
#openai-compatibility: openai-compatibility:
# - name: "openrouter" # The name of the provider; it will be used in the user agent and other places. - name: "openrouter" # The name of the provider; it will be used in the user agent and other places.
# base-url: "https://openrouter.ai/api/v1" # The base URL of the provider. base-url: "https://openrouter.ai/api/v1" # The base URL of the provider.
# headers: headers:
# X-Custom-Header: "custom-value" X-Custom-Header: "custom-value"
# # New format with per-key proxy support (recommended): api-key-entries:
# api-key-entries: - api-key: "sk-or-v1-...b780"
# - api-key: "sk-or-v1-...b780" proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override - api-key: "sk-or-v1-...b781" # without proxy-url
# - api-key: "sk-or-v1-...b781" # without proxy-url models: # The models supported by the provider.
# # Legacy format (still supported, but cannot specify proxy per key): - name: "moonshotai/kimi-k2:free" # The actual model name.
# # api-keys: alias: "kimi-k2" # The alias used in the API.
# # - "sk-or-v1-...b780"
# # - "sk-or-v1-...b781"
# models: # The models supported by the provider.
# - name: "moonshotai/kimi-k2:free" # The actual model name.
# alias: "kimi-k2" # The alias used in the API.
# Vertex API keys (Vertex-compatible endpoints, use API key + base URL) # Vertex API keys (Vertex-compatible endpoints, use API key + base URL)
#vertex-api-key: vertex-api-key:
# - api-key: "vk-123..." # x-goog-api-key header - api-key: "vk-123..." # x-goog-api-key header
# base-url: "https://example.com/api" # e.g. https://zenmux.ai/api base-url: "https://example.com/api" # e.g. https://zenmux.ai/api
# proxy-url: "socks5://proxy.example.com:1080" # optional per-key proxy override proxy-url: "socks5://proxy.example.com:1080" # optional per-key proxy override
# headers: headers:
# X-Custom-Header: "custom-value" X-Custom-Header: "custom-value"
# models: # optional: map aliases to upstream model names models: # optional: map aliases to upstream model names
# - name: "gemini-2.0-flash" # upstream model name - name: "gemini-2.0-flash" # upstream model name
# alias: "vertex-flash" # client-visible alias alias: "vertex-flash" # client-visible alias
# - name: "gemini-1.5-pro" - name: "gemini-1.5-pro"
# alias: "vertex-pro" alias: "vertex-pro"
#payload: # Optional payload configuration # Amp Integration
# default: # Default rules only set parameters when they are missing in the payload. ampcode:
# - models: # Configure upstream URL for Amp CLI OAuth and management features
# - name: "gemini-2.5-pro" # Supports wildcards (e.g., "gemini-*") upstream-url: "https://ampcode.com"
# protocol: "gemini" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex # Optional: Override API key for Amp upstream (otherwise uses env or file)
# params: # JSON path (gjson/sjson syntax) -> value upstream-api-key: ""
# "generationConfig.thinkingConfig.thinkingBudget": 32768 # Restrict Amp management routes (/api/auth, /api/user, etc.) to localhost only (recommended)
# override: # Override rules always set parameters, overwriting any existing values. restrict-management-to-localhost: true
# - models: # Amp Model Mappings
# - name: "gpt-*" # Supports wildcards (e.g., "gpt-*") # Route unavailable Amp models to alternative models available in your local proxy.
# protocol: "codex" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex # Useful when Amp CLI requests models you don't have access to (e.g., Claude Opus 4.5)
# params: # JSON path (gjson/sjson syntax) -> value # but you have a similar model available (e.g., Claude Sonnet 4).
# "reasoning.effort": "high" model-mappings:
- from: "claude-opus-4.5" # Model requested by Amp CLI
to: "claude-sonnet-4" # Route to this available model instead
- from: "gpt-5"
to: "gemini-2.5-pro"
- from: "claude-3-opus-20240229"
to: "claude-3-5-sonnet-20241022"
# OAuth provider excluded models # OAuth provider excluded models
#oauth-excluded-models: oauth-excluded-models:
# gemini-cli: gemini-cli:
# - "gemini-2.5-pro" # exclude specific models (exact match) - "gemini-2.5-pro" # exclude specific models (exact match)
# - "gemini-2.5-*" # wildcard matching prefix (e.g. gemini-2.5-flash, gemini-2.5-pro) - "gemini-2.5-*" # wildcard matching prefix (e.g. gemini-2.5-flash, gemini-2.5-pro)
# - "*-preview" # wildcard matching suffix (e.g. gemini-3-pro-preview) - "*-preview" # wildcard matching suffix (e.g. gemini-3-pro-preview)
# - "*flash*" # wildcard matching substring (e.g. gemini-2.5-flash-lite) - "*flash*" # wildcard matching substring (e.g. gemini-2.5-flash-lite)
# vertex: vertex:
# - "gemini-3-pro-preview" - "gemini-3-pro-preview"
# aistudio: aistudio:
# - "gemini-3-pro-preview" - "gemini-3-pro-preview"
# antigravity: antigravity:
# - "gemini-3-pro-preview" - "gemini-3-pro-preview"
# claude: claude:
# - "claude-3-5-haiku-20241022" - "claude-3-5-haiku-20241022"
# codex: codex:
# - "gpt-5-codex-mini" - "gpt-5-codex-mini"
# qwen: qwen:
# - "vision-model" - "vision-model"
# iflow: iflow:
# - "tstars2.0" - "tstars2.0"
# Optional payload configuration
payload:
default: # Default rules only set parameters when they are missing in the payload.
- models:
- name: "gemini-2.5-pro" # Supports wildcards (e.g., "gemini-*")
protocol: "gemini" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex
params: # JSON path (gjson/sjson syntax) -> value
"generationConfig.thinkingConfig.thinkingBudget": 32768
override: # Override rules always set parameters, overwriting any existing values.
- models:
- name: "gpt-*" # Supports wildcards (e.g., "gpt-*")
protocol: "codex" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex
params: # JSON path (gjson/sjson syntax) -> value
"reasoning.effort": "high"