Skip to content

Instantly share code, notes, and snippets.

@nestharus
Last active November 19, 2025 00:16
Show Gist options
  • Select an option

  • Save nestharus/67ed344108f9af865a01f7798786c151 to your computer and use it in GitHub Desktop.

Select an option

Save nestharus/67ed344108f9af865a01f7798786c151 to your computer and use it in GitHub Desktop.
Download as zip
Create empty auths folder in directory
Create empty logs folder in directory
Within directory
docker-compose up -d
OpenAI: docker exec -it cli-proxy-api ./CLIProxyAPI --codex-login
Google: docker exec -it cli-proxy-api ./CLIProxyAPI --login
Anthropic: docker exec -it cli-proxy-api /CLIProxyAPI/CLIProxyAPI --claude-login
Within your .factory folder for Droid copy over config.json or edit your own config.json to include the entries you want.
{
"custom_models": [
{
"model_display_name": "GPT-5.1 Codex (Low)",
"model": "gpt-5.1-codex-low",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai",
"max_tokens": 128000
},
{
"model_display_name": "GPT-5.1 Codex (Medium)",
"model": "gpt-5.1-codex-medium",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai",
"max_tokens": 128000
},
{
"model_display_name": "GPT-5.1 Codex (High)",
"model": "gpt-5.1-codex-high",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai",
"max_tokens": 128000
},
{
"model_display_name": "GPT-5.1 (Low)",
"model": "gpt-5.1-minimal",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai",
"max_tokens": 128000
},
{
"model_display_name": "GPT-5.1 (Medium)",
"model": "gpt-5.1-medium",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai",
"max_tokens": 128000
},
{
"model_display_name": "GPT-5.1 (High)",
"model": "gpt-5.1-high",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai",
"max_tokens": 128000
},
{
"model_display_name": "Claude Haiku 4.5",
"model": "claude-haiku-4.5",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "anthropic",
"max_tokens": 65536
},
{
"model_display_name": "Claude Opus 4.1",
"model": "claude-opus-4.1",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "anthropic",
"max_tokens": 65536
},
{
"model_display_name": "Claude Sonnet 4.5 (Thinking)",
"model": "claude-sonnet-4.5-thinking",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "anthropic",
"max_tokens": 65536
},
{
"model_display_name": "Claude Sonnet 4.5 (Non-Thinking)",
"model": "claude-sonnet-4.5",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "anthropic",
"max_tokens": 65536
},
{
"model_display_name": "Gemini 3 Pro (Low Thinking)",
"model": "gemini-3-pro-preview-low",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "Gemini 3 Pro (High Thinking)",
"model": "gemini-3-pro-preview-high",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
}
]
}
# Server port
port: 8317
# Management API settings
remote-management:
# Whether to allow remote (non-localhost) management access.
# When false, only localhost can access management endpoints (a key is still required).
allow-remote: false
# Management key. If a plaintext value is provided here, it will be hashed on startup.
# All management requests (even from localhost) require this key.
# Leave empty to disable the Management API entirely (404 for all /v0/management routes).
secret-key: ""
# Disable the bundled management control panel asset download and HTTP route when true.
disable-control-panel: false
# Authentication directory (supports ~ for home directory)
auth-dir: "~/.cli-proxy-api"
# API keys for authentication
# api-keys:
# - "your-api-key-1"
# - "your-api-key-2"
# Enable debug logging
debug: false
# When true, write application logs to rotating files instead of stdout
logging-to-file: false
# When false, disable in-memory usage statistics aggregation
usage-statistics-enabled: false
# Proxy URL. Supports socks5/http/https protocols. Example: socks5://user:[email protected]:1080/
proxy-url: ""
# Number of times to retry a request. Retries will occur if the HTTP response code is 403, 408, 500, 502, 503, or 504.
request-retry: 3
# Quota exceeded behavior
quota-exceeded:
switch-project: true # Whether to automatically switch to another project when a quota is exceeded
switch-preview-model: true # Whether to automatically switch to a preview model when a quota is exceeded
# When true, enable authentication for the WebSocket API (/v1/ws).
ws-auth: false
# 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"
# - 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-key:
# - api-key: "sk-atSM..."
# base-url: "https://www.example.com" # use the custom codex API endpoint
# headers:
# X-Custom-Header: "custom-value"
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
# Claude API keys
#claude-api-key:
# - api-key: "sk-atSM..." # use the official claude API key, no need to set the base url
# - api-key: "sk-atSM..."
# base-url: "https://www.example.com" # use the custom claude API endpoint
# headers:
# X-Custom-Header: "custom-value"
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
# models:
# - name: "claude-3-5-sonnet-20241022" # upstream model name
# alias: "claude-sonnet-latest" # client alias mapped to the upstream model
# OpenAI compatibility providers
#openai-compatibility:
# - 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.
# headers:
# X-Custom-Header: "custom-value"
# # New format with per-key proxy support (recommended):
# api-key-entries:
# - api-key: "sk-or-v1-...b780"
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
# - api-key: "sk-or-v1-...b781" # without proxy-url
# # Legacy format (still supported, but cannot specify proxy per key):
# # api-keys:
# # - "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.
#payload: # Optional payload configuration
# 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"
services:
cli-proxy-api:
image: nestharus/cli-proxy-api:latest
pull_policy: always
container_name: cli-proxy-api
environment:
DEPLOY: ${DEPLOY:-}
ports:
- "8317:8317"
- "8085:8085"
- "1455:1455"
- "54545:54545"
- "11451:11451"
volumes:
- ./config.yaml:/CLIProxyAPI/config.yaml
- ./auths:/root/.cli-proxy-api
- ./logs:/CLIProxyAPI/logs
restart: unless-stopped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment