CCAPI
  1. Chat
CCAPI
  • Chat
    • Create chat completion
      POST
  • Audio
    • Convert text to speech
      POST
  • Images
    • Generate images (OpenAI-compatible)
      POST
    • Generate images (multimodal contents API)
      POST
    • Get job status
      GET
  • Catalog
    • List available models
      GET
    • List providers
      GET
    • Get provider details
      GET
  • Schemas
    • Schemas
      • ErrorObject
      • ErrorResponse
      • ChatMessage
      • ChatToolFunction
      • ChatTool
      • ChatCompletionRequest
      • ChatCompletionResponse
      • AudioSpeechRequest
      • AudioSpeechResponse
      • LegacyImageGenerationRequest
      • LegacyImageGenerationResponse
      • MultimodalInputContent
      • MultimodalImageParameters
      • MultimodalImageGenerationRequest
      • ImageDatum
      • MultimodalImageGenerationResponse
      • ModelSummary
      • ModelListResponse
      • ProviderSummary
      • ProviderListResponse
      • ProviderDetailResponse
    • Response
      • BadRequest
      • Unauthorized
      • BillingError
      • RateLimit
      • InternalError
  1. Chat

Create chat completion

POST
/chat/completions
OpenAI-compatible chat completions endpoint. Supports single-provider requests via
model as well as automatic failover across providers via models.

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/jsonRequired

Examples
{
    "model": "openai/gpt-4o-mini",
    "messages": [
        {
            "role": "system",
            "content": "You are a precise assistant."
        },
        {
            "role": "user",
            "content": "Outline a launch plan for CCAPI."
        }
    ],
    "stream": false
}

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
curl --location --request POST 'http://prod-cn.your-api-server.com/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "openai/gpt-4o-mini",
    "messages": [
        {
            "role": "system",
            "content": "You are a precise assistant."
        },
        {
            "role": "user",
            "content": "Outline a launch plan for CCAPI."
        }
    ],
    "stream": false
}'

Responses

🟢200OK
application/json
Chat completion response. SSE stream when stream=true.
Body

Example
{
    "id": "chatcmpl-123",
    "object": "chat.completion",
    "created": 1717430400,
    "model": "openai/gpt-4o-mini",
    "provider": "openai",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "1. Align requirements...\n"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 120,
        "completion_tokens": 256,
        "total_tokens": 376,
        "input_cost": 0.024,
        "output_cost": 0.051
    }
}
🟠400Bad Request
🟠401Unauthorized
🟠402Payment Required
🟠429Too Many Requests
🔴500Internal Server Error
Modified at 2025-11-12 07:09:16
Next
Convert text to speech
Built with