CCAPI
  1. Images
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. Images

Generate images (OpenAI-compatible)

POST
/images/generations
Drop-in replacement for POST /v1/images/generations from OpenAI. Accepts text
prompts plus optional size, n, and response_format parameters.

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

Example
{
    "model": "stabilityai/stable-diffusion-xl-1024-v1-0",
    "prompt": "photorealistic drone shot of a solar farm at sunrise",
    "n": 2,
    "size": "1024x1024"
}

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 'http://prod-cn.your-api-server.com/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "stabilityai/stable-diffusion-xl-1024-v1-0",
    "prompt": "photorealistic drone shot of a solar farm at sunrise",
    "n": 2,
    "size": "1024x1024"
}'

Responses

🟢200OK
application/json
Images generated successfully
Body

Example
{
    "id": "string",
    "created": 0,
    "model": "string",
    "provider": "string",
    "data": [
        {
            "url": "http://example.com",
            "b64_json": "string"
        }
    ],
    "revised_prompt": "string"
}
🟠400Bad Request
🟠401Unauthorized
🟠402Payment Required
🟠429Too Many Requests
🔴500Internal Server Error
Modified at 2025-11-12 07:09:16
Previous
Convert text to speech
Next
Generate images (multimodal contents API)
Built with