The general recipe
Most AI tools support an “OpenAI-compatible API” and need only two things:
| Name in the tool | What to enter |
|---|---|
| API address / Base URL / Endpoint | The “API address (Base URL)” from the login-info file: https://your-IP:8318/v1 |
| API Key | The “API Key” from the login-info file |
| Model name | A model name listed by the curl command in Add accounts |
CLIProxyAPI is also compatible with Claude- and Gemini-style APIs.
- In Cherry Studio’s settings, open the model services page, add a provider and set its type to OpenAI.
- Enter the API key; for the API address enter
https://your-IP:8318(Cherry Studio adds/v1itself; if it won’t connect, try the fullhttps://your-IP:8318/v1). - Click “Manage” or fetch the model list, add the models you want, then run the check.
Set two environment variables before starting Claude Code (address without /v1):
Point Claude Code at your API
export ANTHROPIC_BASE_URL="https://your-IP:8318"
export ANTHROPIC_AUTH_TOKEN="your-API-Key"
claudeThis needs an account in the management center that provides Claude models. For a one-off, set them in the same terminal; for regular use, put them in your shell’s config file.
Add a custom provider to ~/.codex/config.toml (create the file if it doesn’t exist):
~/.codex/config.toml
model_provider = "cpa"
model = "a model name from the curl list"
[model_providers.cpa]
name = "CLIProxyAPI"
base_url = "https://your-IP:8318/v1"
env_key = "CPA_API_KEY"
wire_api = "responses"Then set the key in the terminal and start it: export CPA_API_KEY="your-API-Key", then run codex.
Send one message
curl -s https://your-IP:8318/v1/chat/completions \
-H "Authorization: Bearer your-API-Key" \
-H "Content-Type: application/json" \
-d '{"model":"model-name","messages":[{"role":"user","content":"Hello"}]}'A JSON reply containing the model’s answer means the API works.