> ## Documentation Index
> Fetch the complete documentation index at: https://docs.toapis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Call text, image, and video models through ToAPIs

> [!NOTE]
>
> **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](https://toapis.com/dashboard/tokens)
2. Sign in and create an API key
3. Save it securely when shown; it is displayed only once

## Step 2: Choose a Model

| Type | Suggested starter model | Description |
| - | - | - |
| Text | `gpt-5.6-terra` | Balanced performance and cost for chat and agent workflows |
| Image | `gpt-image-2` | Text-to-image and reference-image generation |
| Video | `seedance-2` | Text-to-video, first/last-frame image-to-video, and multimodal references |

Use the [model list endpoint](https://docs.toapis.com/docs/en/api-reference/chat/list-models.md) and individual model pages as the source of truth for availability.

## Step 3: Send Requests

### Text generation

```bash theme={null}
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

```bash theme={null}
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

```bash theme={null}
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:

```bash theme={null}
# 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](https://docs.toapis.com/docs/en/api-reference/webhooks/task-webhooks.md).

## What's Next

> **[View API docs](https://docs.toapis.com/docs/en.md)**
>
> Browse all endpoints, models, and parameters.

> **[Claude Code Integration](https://docs.toapis.com/docs/en/integrations/claude-code.md)**
>
> Use ToAPIs with Claude Code.

> **[Codex Integration](https://docs.toapis.com/docs/en/integrations/codex.md)**
>
> Use ToAPIs with Codex through CC Switch.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.