이미지·음성·동영상·검색 통합

이 기능들은 채팅과 동일한 Base URL과 bearer 키를 사용하지만, 각각 고유한 엔드포인트와 페이로드를 가집니다. 아래 모델 ID는 동작 예시이니, 배포 전에 콘솔 → 모델에서 최신 모델 카탈로그를 확인하세요.

이미지 생성

POST /v1/images/generations

JSON 프롬프트를 전송하세요. 생성된 결과는 data[0].url에서, 선택한 모델이 base64를 반환하는 경우에는 data[0].b64_json에서 읽습니다.

주요 파라미터: promptmodel은 필수입니다. 해상도는 size, 이미지 개수는 n, 반환 형식은 response_formaturl 또는 b64_json을 사용하세요. qualitystyle은 모델별로 다르며, 일반적인 값으로는 standard, hd, auto가 있습니다.

curl · image
curl https://api.chinaapi.ai/v1/images/generations \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-4-5-251128",
    "prompt": "A cinematic skyline at blue hour",
    "size": "1024x1024",
    "response_format": "url",
    "n": 1
  }'

Gemini 이미지 생성

POST /v1/chat/completions

Gemini 이미지 모델은 OpenAI Chat Completions 요청 형식을 사용합니다. 생성된 Markdown 이미지는 choices[0].message.content에서 읽으며, 이미지 페이로드는 data:image/... URL입니다.

주요 파라미터: 로그인 후 카탈로그의 모델 ID를 model에, 이미지 프롬프트를 messages에 담으세요. 이 모델을 /v1/images/generations로 보내지 마세요.

curl · Gemini image chat
curl https://api.chinaapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<GEMINI_IMAGE_MODEL>",
    "messages": [
      {
        "role": "user",
        "content": "Generate a cinematic skyline at blue hour"
      }
    ],
    "stream": false
  }'

음성 인식

POST /v1/audio/transcriptions

오디오를 multipart form data로 업로드하세요. Content-Type 헤더를 수동으로 설정하지 마세요. 인식된 텍스트는 text 필드로 반환됩니다.

주요 파라미터: modelfile을 multipart 필드로 전송하세요. 선택한 모델이 지원하는 경우 response_formatjson, text, verbose_json을 사용할 수 있습니다.

curl · transcription
curl https://api.chinaapi.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -F "model=qwen3-asr-flash" \
  -F "file=@speech.wav" \
  -F "response_format=json"

음성 합성

POST /v1/audio/speech

응답 본문은 바이너리 오디오이므로 파일로 저장하세요. alloy는 모델의 기본 음성을 선택하며, 모델에 따라 제공업체 고유의 음성 ID도 제공할 수 있습니다.

주요 파라미터: input, model, voice를 사용하세요. response_format으로 mp3wav 등의 출력을 선택하며, 선택한 모델이 지원하는 경우 speedinstructions를 사용할 수 있습니다.

curl · speech
curl https://api.chinaapi.ai/v1/audio/speech \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mimo-v2.5-tts",
    "input": "Hello from ChinaAPI.",
    "voice": "alloy",
    "response_format": "mp3"
  }' \
  --output speech.mp3

동영상 생성

POST /v1/video/generations

동영상 생성은 비동기로 처리됩니다. 한 번만 요청을 보내 반환된 task_id를 저장한 뒤, 성공하거나 실패할 때까지 GET /v1/video/generations/{task_id}를 폴링하세요. 작업 생성은 쿼터를 소비할 수 있습니다.

주요 파라미터: promptmodel로 작업을 시작합니다. 지원되는 경우 duration, width, height, fps, n을 사용하세요. 해상도는 일반적인 화질 제어 수단입니다. quality, quality_level, negative_prompt, 카메라 설정 등 제공업체 고유 옵션은 해당 모델에 명시된 경우에만 metadata에 넣으세요.

curl · video
curl https://api.chinaapi.ai/v1/video/generations \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse-1.1-t2v",
    "prompt": "A paper boat crossing a moonlit lake",
    "duration": 5,
    "width": 1280,
    "height": 720
  }'

curl https://api.chinaapi.ai/v1/video/generations/$TASK_ID \
  -H "Authorization: Bearer $CHINAAPI_KEY"