This guide walks you through connecting OpenClaw to CCAPI step-by-step. CCAPI is a fully OpenAI-compatible API gateway — OpenClaw treats it as a standard OpenAI endpoint, so no code changes are needed.
Registers CCAPI as a custom provider named "ccapi". You can use any name.
baseUrl
CCAPI endpoint. Always https://api.ccapi.ai/v1.
apiKey
Your CCAPI API key. Use $CCAPI_API_KEY to reference an environment variable, or paste the key directly (less secure).
api
Must be "openai-completions". Tells OpenClaw to use the OpenAI chat completions protocol.
models
Array of model IDs available through this provider. Only models listed here will appear in OpenClaw's model selector.
agents.defaults.model.primary
Default model for new agent sessions. Format: provider-name/model-id where provider-name matches the key under models.providers (in this case ccapi).
Important notes:
The apiKey field supports env var syntax: "$CCAPI_API_KEY" reads from the CCAPI_API_KEY environment variable. This is more secure than hardcoding the key.
The models array determines which models OpenClaw offers you. You can list as many or as few as you want.
The primary model uses the format ccapi/deepseek/deepseek-chat — the first segment (ccapi) is the provider name you defined under models.providers, followed by the CCAPI model ID.
With the openclaw.json method (Method B), you can list multiple models and switch between them during a session using OpenClaw's model selector — no restart needed.
Base URL:https://api.ccapi.ai/v1Auth:Authorization: Bearer sk-your-ccapi-api-keyEndpoint:POST /v1/chat/completionsModel ID format:provider/model-id (e.g., deepseek/deepseek-chat, openai/gpt-4o)Supported features: streaming, tool/function calling, vision (image input), JSON mode, system messagesFull API docs: docs.ccapi.ai
Request
Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/json
Example
{"model":"deepseek/deepseek-chat","messages":[{"role":"system","content":"You are a helpful AI assistant."},{"role":"user","content":"Hello from OpenClaw!"}],"stream":true,"max_tokens":4096}
Request Code Samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl--location--request POST 'https://api.ccapi.ai/api/v1/chat/completions' \
--header'Authorization: Bearer <token>' \
--header'Content-Type: application/json' \
--data-raw'{
"model": "deepseek/deepseek-chat",
"messages": [
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Hello from OpenClaw!"
}
],
"stream": true,
"max_tokens": 4096
}'
Responses
🟢200成功
application/json
Chat completion response
Body
Example
{"id":"chatcmpl-abc123","object":"chat.completion","created":1709000000,"model":"deepseek/deepseek-chat","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! I'm DeepSeek V3, running through CCAPI. How can I help you today?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":24,"completion_tokens":18,"total_tokens":42}}