> ## 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.

# ​快速开始

# [​](#快速开始)快速开始

欢迎使用我们的API服务！本指南将帮助您快速开始使用图像和视频生成功能。

## [​](#第一步：获取api密钥)第一步：获取API密钥

1. 访问 [API密钥管理页面](https://toapis.com/console/token)
2. 登录您的账户
3. 创建新的API密钥
4. 保存您的密钥（密钥只显示一次）

## [​](#第二步：选择模型)第二步：选择模型

我们提供多种AI模型供您选择：

### [​](#文字生成模型)文字生成模型

* **GPT-4o**: 强大的对话和文本生成能力
* **Claude**: Anthropic 的高性能对话模型
* **Gemini**: Google 的多模态大语言模型

### [​](#图像生成模型)图像生成模型

* **GPT-4o-image**: 高质量图像生成
* **gpt-image-2**: 支持 `reference_images` 的 OpenAI 兼容图像生成

### [​](#视频生成模型)视频生成模型

* **Sora2**: 专业视频生成

## [​](#第三步：发送请求)第三步：发送请求

### [​](#文字生成示例)文字生成示例

复制

```shiki theme={null}
curl -X POST https://toapis.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "你好，请介绍一下你自己"
      }
    ]
  }'

```

### [​](#图像生成示例)图像生成示例

复制

```shiki theme={null}
curl -X POST https://toapis.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-image",
    "client_business_id": "order_20260428_001",
    "prompt": "一只可爱的熊猫",
    "size": "1:1",
    "n": 1
  }'

```

### [​](#视频生成示例)视频生成示例

复制

```shiki theme={null}
curl -X POST https://toapis.com/v1/videos/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "client_business_id": "order_20260428_002",
    "prompt": "海浪拍打着海岸",
    "duration": 15,
    "aspect_ratio": "16:9"
  }'

```

<Note>
  `client_business_id` 是您的业务 ID，例如订单号、流水号或您系统内的任务 ID。创建图片或视频任务时传入后，可用它查询任务状态：
  `GET /v1/images/generations/{client_business_id}` 或 `GET /v1/videos/generations/{client_business_id}`。
</Note>

## [​](#第四步：查询任务状态)第四步：查询任务状态

由于我们使用异步处理模式，您需要查询任务状态来获取结果：
复制

```shiki theme={null}
curl -X GET https://toapis.com/v1/images/generations/order_20260428_001 \
  -H "Authorization: Bearer YOUR_API_KEY"

```

## [​](#下一步)下一步

<CardGroup cols={2}>
  <Card title="查看 API 文档" icon="book" href="./index">
    详细了解所有可用的 API 接口。
  </Card>

  <Card title="Claude Code 集成" icon="code" href="./integrations/claude-code">
    了解如何将 API 集成到您的开发工作流。
  </Card>
</CardGroup>
