ccapi
🇺🇸English
  • 🇨🇳简体中文
  • 🇺🇸English
Home
Home
🇺🇸English
  • 🇨🇳简体中文
  • 🇺🇸English
🇺🇸English
  • 🇨🇳简体中文
  • 🇺🇸English
    • OpenClaw + CCAPI LLM Integration Guide
    • claude code integration
    • codex cli integration
    • gemini cli integration
    • Chat
      • OpenAI
        • Create Chat Completion
        • Create Response
      • Google
        • Generate Content
        • Stream Generate Content
      • Anthropic
        • Create Message
      • DeepSeek
        • Create Chat Completion
      • MiniMax
        • Create Chat Completion
    • Image
      • nano banana
        • Generate Image
      • z-image-turbo
        • integration docs
      • seedream
        • integration doc
    • Video
      • seedance
      • vidu
    • Audio
      • Producer
        • Generate Music
        • Generate Lyrics
        • Extend Music
        • Create Cover
        • Create Variation
        • Replace Segment
        • Vocals Swap
        • Instrumentals Swap
        • Stem Separation
        • Download Audio
        • Upload Audio
        • Generate Video
        • Fetch Task Status
        • Batch Fetch Tasks
      • Suno
        • Generate Music
        • Fetch Task Status
        • Generate Lyrics
        • Extend Music
        • Create Cover
        • Extract Stems
        • Extract All Stems
        • Add Vocals
        • Add Instrumental
        • Replace Section
        • Remaster Song
        • Mashup
        • Sample Section
        • Generate Sounds
        • Generate MIDI
        • Upload Audio
        • Concatenate Music
        • Get Aligned Lyrics
        • Generate Music Video
        • Export as WAV
        • Create Voice Persona(unavailable)
        • Detect BPM
        • Extract Vocals
        • Upsample Tags
        • Batch Fetch Tasks

    OpenClaw + CCAPI LLM Integration Guide

    How to Integrate CCAPI LLM into OpenClaw#

    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.
    OpenClaw is an open-source personal AI assistant that supports multi-platform messaging (WhatsApp, Telegram, Slack, Discord, etc.) and can execute real-world tasks like file management, coding, and web browsing.

    Prerequisites#

    1.
    OpenClaw installed — any version that supports custom LLM providers
    2.
    CCAPI account — sign up at ccapi.ai
    3.
    CCAPI API Key — create a token in the console

    Step 1: Get Your CCAPI Token#

    1.
    Go to ccapi.ai and sign up / log in (Google login supported)
    2.
    Navigate to Console > Tokens
    3.
    Click Create Token, name it openclaw
    4.
    Copy the token key (shown only once)

    Step 2: Choose a Model#

    CCAPI aggregates models from multiple providers at prices well below official rates:
    ProviderCCAPI PriceModels
    OpenAIAs low as 10% of officialGPT-4o, GPT-5 series, etc.
    GoogleAs low as 20% of officialGemini 2.5 Flash/Pro, etc.
    AnthropicAs low as 20% of officialClaude Sonnet/Opus, etc.
    DeepSeek85% of officialDeepSeek V3.2, etc.
    MiniMax85% of officialMiniMax M2.5, etc.
    Zhipu85% of officialGLM-5, etc.
    For the full model list and real-time pricing, visit Model Market.
    Recommended models for OpenClaw:

    Budget Models (Best Cost-to-Quality)#

    ModelProviderContextHighlights
    gpt-5-nanoOpenAI1MUltra-low cost, good for simple tasks
    gemini-2.5-flashGoogle1MFast, large context window
    gpt-4o-miniOpenAI128KBalanced choice
    deepseek-v3.2DeepSeek128KStrong coding and reasoning
    minimax-m2.5MiniMax1M1M context, excellent at coding

    Mid-Tier Models (Quality + Affordability)#

    ModelProviderContextHighlights
    gpt-5-miniOpenAI1MGPT-5 family, fast and reliable
    glm-5Zhipu32KExcellent Chinese language capabilities
    gemini-2.5-proGoogle1MGoogle's strongest model, multimodal

    Premium Models (Maximum Quality)#

    ModelProviderContextHighlights
    gpt-4oOpenAI128KMultimodal, proven quality
    claude-sonnet-4-5Anthropic200KAnthropic flagship
    gpt-4.1OpenAI1M1M context window

    Vision-Capable Models (for screenshot analysis)#

    If you use OpenClaw's screenshot/vision features, choose a vision-capable model:
    ModelProviderHighlights
    gemini-2.5-flashGoogleCheapest vision option
    gpt-5-miniOpenAIBest vision value
    gpt-4oOpenAIBest overall vision quality
    gemini-2.5-proGoogleGoogle's best vision

    Step 3: Configure OpenClaw#

    There are three ways to connect OpenClaw to CCAPI. Choose the one that fits your workflow.

    Method A: Environment Variables (Simplest)#

    Add these to your shell profile (~/.bashrc, ~/.zshrc) or OpenClaw's .env file:
    VariableRequiredDescription
    OPENCLAW_BASE_URLYesMust be https://api.ccapi.ai/v1
    OPENCLAW_API_KEYYesYour CCAPI token
    OPENCLAW_MODELYesDefault model, e.g. deepseek-v3.2
    OPENCLAW_FALLBACK_MODELNoBackup model, auto-switches on failure
    Restart your terminal and OpenClaw after setting the variables.

    Method B: Config File (Most Flexible)#

    Edit ~/.openclaw/openclaw.json for multi-model setups:
    {
      models: {
        mode: "merge",
        providers: {
          ccapi: {
            baseUrl: "https://api.ccapi.ai/v1",
            apiKey: "${CCAPI_API_KEY}",
            api: "openai-completions",
            models: [
              {
                id: "deepseek-v3.2",
                name: "DeepSeek V3.2",
                reasoning: false,
                input: ["text"],
                contextWindow: 128000,
                maxTokens: 32000,
              },
              {
                id: "gpt-4o",
                name: "GPT-4o",
                reasoning: false,
                input: ["text", "image"],
                contextWindow: 128000,
                maxTokens: 16384,
              },
              {
                id: "gpt-5-mini",
                name: "GPT-5 Mini",
                reasoning: false,
                input: ["text", "image"],
                contextWindow: 1000000,
                maxTokens: 32000,
              },
              {
                id: "gemini-2.5-flash",
                name: "Gemini 2.5 Flash",
                reasoning: false,
                input: ["text", "image"],
                contextWindow: 1000000,
                maxTokens: 65536,
              },
              {
                id: "minimax-m2.5",
                name: "MiniMax M2.5",
                reasoning: false,
                input: ["text"],
                contextWindow: 1000000,
                maxTokens: 32000,
              },
              {
                id: "glm-5",
                name: "GLM-5",
                reasoning: false,
                input: ["text"],
                contextWindow: 32000,
                maxTokens: 4096,
              },
              {
                id: "claude-sonnet-4-5",
                name: "Claude Sonnet 4.5",
                reasoning: true,
                input: ["text", "image"],
                contextWindow: 200000,
                maxTokens: 64000,
              },
            ],
          },
        },
      },
      agents: {
        defaults: {
          model: {
            primary: "ccapi/deepseek-v3.2",
          },
        },
      },
    }
    FieldDescription
    models.providers.ccapiRegisters CCAPI as a custom provider named "ccapi"
    baseUrlCCAPI endpoint, always https://api.ccapi.ai/v1
    apiKeyUse "${CCAPI_API_KEY}" to reference an env var (more secure), or paste the token directly
    apiMust be "openai-completions" — tells OpenClaw to use the OpenAI protocol
    modelsModel catalog for this provider. Only listed models appear in OpenClaw's model selector
    agents.defaults.model.primaryDefault model. Format: provider-name/model-id, e.g. ccapi/deepseek-v3.2
    Tip: mode: "merge" combines with built-in catalogs; mode: "replace" fully overwrites them.

    Method C: CLI Commands (Quick Setup)#

    Verify the config:

    Step 4: Verify the Integration#

    4.1 Test the API Key Directly#

    You should get a JSON response with choices[0].message.content.

    4.2 Test Streaming#

    4.3 Test in OpenClaw#

    Launch OpenClaw and give it a simple task:
    What is 2 + 2?
    If OpenClaw responds normally, the integration is working. You can check the call logs at CCAPI Console.

    4.4 Test Tool Calling#

    OpenClaw relies heavily on tool/function calling (shell commands, file operations, etc.). Verify:
    List the files in the current directory.
    OpenClaw should call a shell tool to run ls and return the output. All CCAPI text models support function calling.

    Step 5: Optimize Your Setup#

    Recommended Configurations#

    Daily automation (~$3/month)
    Best for: file management, web browsing, shell scripts, everyday tasks.
    Coding assistant (~$8/month)
    Best for: code review, debugging, refactoring.
    Quality-first (~$15/month)
    Best for: complex reasoning, multi-step tasks, screenshot analysis.
    Chinese language tasks
    Best for: Chinese documentation, code with Chinese comments, Chinese web browsing.

    Cost Comparison#

    Using the same model usage, calling through CCAPI significantly reduces costs:
    ProviderDirect OfficialVia CCAPISavings
    OpenAIOfficial priceAs low as 10%Save up to 90%+
    Google GeminiOfficial priceAs low as 20%Save up to 78%
    Anthropic ClaudeOfficial priceAs low as 20%Save up to 78%
    DeepSeekOfficial price85%Save 15%
    CCAPI is pay-as-you-go with no subscription fees. For specific pricing, visit Model Market.

    Troubleshooting#

    ProblemCauseSolution
    Invalid tokenToken is incorrect or expiredCheck token status at Console > Tokens
    Token quota exhaustedAccount balance is $0Top up at Console > Top Up
    Model not foundModel name typoCheck model name spelling. View available models at Model Market
    OpenClaw still uses OpenAIOPENCLAW_BASE_URL not setVerify with echo $OPENCLAW_BASE_URL — must output https://api.ccapi.ai/v1
    Tool calls failModel doesn't support function callingAll CCAPI text models support function calling. Check the model name is correct
    Streaming doesn't workNetwork proxy or firewall blocking SSETest with curl -N. Check proxy settings
    Slow responsesModel overloaded or network latencyTry gemini-2.5-flash (fastest model)

    Quick Reference#

    Base URL: https://api.ccapi.ai/v1
    Auth: Authorization: Bearer your-ccapi-token
    Endpoint: POST /v1/chat/completions
    Supported features: streaming, tool/function calling, vision (image input), JSON mode, system messages
    Full Documentation: docs.ccapi.ai
    Model Market: ccapi.ai/pricing
    Console: ccapi.ai/console
    Top Up: ccapi.ai/console/topup
    Logs: ccapi.ai/console/log
    修改于 2026-03-16 08:42:54
    下一页
    claude code integration
    Built with