ToAPIsToAPIs

Quick Start

Call text, image, and video models through ToAPIs

Note for users in mainland China: Please use https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.

ToAPIs provides OpenAI-compatible text endpoints plus unified asynchronous image and video generation APIs. This guide uses currently available models for your first requests.

Step 1: Get an API Key

  1. Open the API Key Management page
  2. Sign in and create an API key
  3. Save it securely when shown; it is displayed only once

Step 2: Choose a Model

TypeSuggested starter modelDescription
Textgpt-5.6-terraBalanced performance and cost for chat and agent workflows
Imagegpt-image-2Text-to-image and reference-image generation
Videoseedance-2Text-to-video, first/last-frame image-to-video, and multimodal references

Use the model list endpoint and individual model pages as the source of truth for availability.

Step 3: Send Requests

Text generation

curl --request POST \
  --url https://toapis.com/v1/chat/completions \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "gpt-5.6-terra",
    "messages": [
      {"role": "user", "content": "Hello, please introduce yourself"}
    ]
  }'

Image generation

curl --request POST \
  --url https://toapis.com/v1/images/generations \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "gpt-image-2",
    "prompt": "A cute panda with cinematic lighting",
    "size": "1:1",
    "resolution": "1k",
    "n": 1
  }'

Video generation

curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "seedance-2",
    "prompt": "Waves crashing against the shore, cinematic camera movement",
    "duration": 5,
    "aspect_ratio": "16:9",
    "resolution": "720p"
  }'

Step 4: Check Asynchronous Tasks

Text requests return directly. Image and video requests return a task ID; use the matching endpoint to retrieve the result:

# Image task
curl https://toapis.com/v1/images/generations/YOUR_TASK_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

# Video task
curl https://toapis.com/v1/videos/generations/YOUR_TASK_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

Configure Task Webhooks

Set the Token's default HTTPS callback URL and generate a signing secret. A task may include a same-origin callback_url. Verify X-ToAPIs-Webhook-* against the raw body with HMAC-SHA256, deduplicate by event ID, and keep polling only as a fallback. On 429, honor Retry-After. See Task Webhooks.

What's Next

On this page