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

# Quickstart

# 快速开始

通过本快速开始指南，学习如何获取 API Key 并发起您的第一个 API 请求！

## 前提条件

* 一个 Mountsea AI 平台账号（[立即注册](https://offoff.ai)）
* 一个 API Key

## 获取 API Key

<Steps>
  <Step title="注册账号">
    在 [offoff.ai](https://offoff.ai) 注册 Mountsea AI 账号。
  </Step>

  <Step title="创建密钥">
    进入 **API Keys** 页面，点击 **Create New Key**。输入密钥名称并点击 **Save**。
  </Step>

  <Step title="复制密钥">
    在 API Keys 页面，点击密钥旁的复制图标，将密钥复制到剪贴板。
  </Step>
</Steps>

## 配置 HTTP 请求

所有 API 请求通过 Bearer Token 认证：

```bash theme={null}
Authorization: Bearer your-api-key
```

**Base URL**：`https://api.mountsea.ai`

***

## 快速示例

<Tabs>
  <Tab title="Hub">
    Hub 将优质 AI 模型聚合在统一接口下。**旗舰画质、生产稳定、价格低于官方零售价。** 切换模型只需修改 `model` 字段。

    ```bash theme={null}
    # 通过 Hub 使用 Nano Banana Pro 生成图像
    curl -X POST "https://api.mountsea.ai/hub/v1/image" \
      -H "Authorization: Bearer your-api-key" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "nano-banana-pro",
        "input": {
          "prompt": "A photorealistic black labrador swimming, half above water, half underwater",
          "resolution": "2K",
          "aspect_ratio": "1:1"
        }
      }'
    # → { "task_id": "hub-xxxxxxxx-..." }

    # 轮询结果
    curl -H "Authorization: Bearer your-api-key" \
      "https://api.mountsea.ai/hub/v1/tasks/hub-xxxxxxxx-..."
    ```

    换成生成视频？只需修改端点和模型：

    ```bash theme={null}
    curl -X POST "https://api.mountsea.ai/hub/v1/video" \
      -H "Authorization: Bearer your-api-key" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "veo-3.1-fast",
        "input": {
          "prompt": "Cinematic drone shot flying through ancient stone ruins at golden hour",
          "duration": "8s",
          "resolution": "720p",
          "aspect_ratio": "16:9",
          "generate_audio": true
        }
      }'
    ```

    <Tip>
      **动态发现模型**：`GET /hub/v1/models?capability=video` 返回所有可用视频模型的完整 `input_schema` 及可直接复制的 `example` 请求体。
    </Tip>
  </Tab>

  <Tab title="Gemini 视频">
    #### 第 1 步：创建视频生成任务

    ```bash theme={null}
    curl -X POST "https://api.mountsea.ai/gemini/video/generate" \
      -H "Authorization: Bearer your-api-key" \
      -H "Content-Type: application/json" \
      -d '{
        "prompt": "一只毛茸茸的橘猫在阳光明媚的草地上奔跑",
        "action": "text2video",
        "model": "veo31_fast",
        "aspectRatio": "16:9"
      }'
    ```

    **响应：**

    ```json theme={null}
    {
      "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
    ```

    #### 第 2 步：轮询任务结果

    ```bash theme={null}
    curl -X GET "https://api.mountsea.ai/gemini/task/result?taskId=your-task-id" \
      -H "Authorization: Bearer your-api-key"
    ```

    **响应（已完成）：**

    ```json theme={null}
    {
      "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "status": "completed",
      "result": {
        "video_url": "https://..."
      },
      "createdAt": "2026-01-01T12:00:00Z",
      "finishedAt": "2026-01-01T12:02:30Z"
    }
    ```

    <Tip>
      每隔数秒轮询任务状态端点，直到 `status` 变为 `completed`。可能的状态：`pending`、`ready`、`assigned`、`processing`、`completed`、`failed`、`cancelled`、`timeout`。
    </Tip>
  </Tab>

  <Tab title="Gemini 图像">
    ```bash theme={null}
    curl -X POST "https://api.mountsea.ai/gemini/image/generate" \
      -H "Authorization: Bearer your-api-key" \
      -H "Content-Type: application/json" \
      -d '{
        "prompt": "A futuristic city skyline at night, neon lights reflecting on wet streets",
        "action": "generate",
        "model": "nano-banana-fast",
        "aspect_ratio": "16:9"
      }'
    ```

    **响应：**

    ```json theme={null}
    {
      "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
    ```

    然后轮询 `/gemini/task/result?taskId=your-task-id` 获取生成的图像。

    <Note>
      可用图像模型：`nano-banana-fast`、`nano-banana-pro`（支持 1K/2K/4K 分辨率）、`nano-banana-2`（支持扩展宽高比）。
    </Note>
  </Tab>

  <Tab title="Suno">
    #### 第 1 步：创建音乐生成任务

    ```bash theme={null}
    curl -X POST "https://api.mountsea.ai/suno/v2/generate" \
      -H "Authorization: Bearer your-api-key" \
      -H "Content-Type: application/json" \
      -d '{
        "task": "create",
        "model": "chirp-v55",
        "tags": "Pop, Happy, Upbeat",
        "prompt": "[Verse]\nHello world, here I come\nShining bright like the morning sun\n\n[Chorus]\nLa la la, sing with me\nFeel the rhythm, feel the beat",
        "title": "Hello World"
      }'
    ```

    **响应：**

    ```json theme={null}
    {
      "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
    ```

    #### 第 2 步：轮询任务状态

    ```bash theme={null}
    curl -X GET "https://api.mountsea.ai/suno/v2/status?taskId=your-task-id" \
      -H "Authorization: Bearer your-api-key"
    ```

    **响应（成功）：**

    ```json theme={null}
    {
      "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "status": "success",
      "data": {
        "...": "clip data with audio URLs"
      },
      "createdAt": "2026-01-01T12:00:00Z",
      "finishAt": "2026-01-01T12:01:30Z"
    }
    ```
  </Tab>

  <Tab title="Producer">
    #### 第 1 步：创建音乐生成任务

    ```bash theme={null}
    curl -X POST "https://api.mountsea.ai/producer/audios" \
      -H "Authorization: Bearer your-api-key" \
      -H "Content-Type: application/json" \
      -d '{
        "action": "create_music",
        "model": "Lyria 3 Pro",
        "title": "Summer Vibes",
        "soundPrompt": "emotional pop with gentle piano, warm synths, and a catchy beat",
        "lyrics": "[Verse]\nSunshine on my face today\nEverything is going my way\n\n[Chorus]\nSummer vibes, feeling alive\nDancing through the day and night",
        "makeInstrumental": false
      }'
    ```

    **响应：**

    ```json theme={null}
    {
      "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
    ```

    #### 第 2 步：轮询任务结果

    ```bash theme={null}
    curl -X GET "https://api.mountsea.ai/producer/tasks?taskId=your-task-id" \
      -H "Authorization: Bearer your-api-key"
    ```

    **响应（已完成）：**

    ```json theme={null}
    {
      "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "status": "completed",
      "result": {
        "...": "audio data with download info"
      },
      "createdAt": "2026-01-01T12:00:00Z",
      "finishedAt": "2026-01-01T12:02:00Z"
    }
    ```
  </Tab>

  <Tab title="Chat">
    直接使用 OpenAI SDK——只需修改 `base_url`：

    **Python**

    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(
        api_key="your-api-key",
        base_url="https://api.mountsea.ai/chat"
    )

    response = client.chat.completions.create(
        model="gpt-5.1",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Hello!"}
        ]
    )

    print(response.choices[0].message.content)
    ```

    **Node.js**

    ```javascript theme={null}
    import OpenAI from 'openai';

    const client = new OpenAI({
        apiKey: 'your-api-key',
        baseURL: 'https://api.mountsea.ai/chat'
    });

    const response = await client.chat.completions.create({
        model: 'gpt-5.1',
        messages: [
            { role: 'system', content: 'You are a helpful assistant.' },
            { role: 'user', content: 'Hello!' }
        ]
    });

    console.log(response.choices[0].message.content);
    ```

    **cURL**

    ```bash theme={null}
    curl -X POST "https://api.mountsea.ai/chat/v1/chat/completions" \
      -H "Authorization: Bearer your-api-key" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "gpt-5.1",
        "messages": [
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Hello!"}
        ]
      }'
    ```

    **使用 Claude Code**

    ```bash theme={null}
    export ANTHROPIC_API_KEY="your-api-key"
    export ANTHROPIC_BASE_URL="https://api.mountsea.ai/chat/claude"

    # 启动 Claude Code
    claude
    ```

    <Warning>
      **注意**：Claude Code 使用 Base URL `https://api.mountsea.ai/chat/claude`，与其他协议使用的 `https://api.mountsea.ai/chat` 不同。
    </Warning>
  </Tab>
</Tabs>

### 🚧 Sora2 — 当前不可用

<Warning>
  **Sora2 当前在 Mountsea 不可用。** 接口 `/sora/*` 会在网关层被拒绝。视频生成请改用以下替代方案：

  * [Hub — 优质 AI 网关](api-reference/hub/introduction) — Veo 3.1、Kling v3、WAN 2.7、Seedance 2.0（推荐）
  * [Gemini 视频（Veo 2 / 3 / 3.1）](api-reference/gemini/video-introduction)
  * [XAI (Grok) 视频](api-reference/xai/introduction)
</Warning>

***

## 异步任务模式

大多数生成服务（Hub、Gemini、OpenAI、XAI、Suno、ElevenLabs、Producer）遵循**异步任务模式**：

```
1. POST 请求 → 返回 taskId
2. 轮询 GET 端点（携带 taskId）→ 完成后返回 status + result
```

| 服务                   | 创建任务                                                                | 轮询状态                                   |
| -------------------- | ------------------------------------------------------------------- | -------------------------------------- |
| **Hub**              | `POST /hub/v1/{image\|video\|audio\|transcribe}`                    | `GET /hub/v1/tasks/:task_id`           |
| **Gemini**           | `POST /gemini/video/generate`                                       | `GET /gemini/task/result?taskId=xxx`   |
| **Gemini 图像**        | `POST /gemini/image/generate`                                       | `GET /gemini/task/result?taskId=xxx`   |
| **🚧 Sora2** *(不可用)* | ~~`POST /sora/video/generate`~~                                     | ~~`GET /sora/task/result?taskId=xxx`~~ |
| **XAI**              | `POST /xai/images` 或 `POST /xai/videos`                             | `GET /xai/tasks?taskId=xxx`            |
| **OpenAI**           | `POST /openai/images`（异步）/ `POST /openai/v1/images/generations`（同步） | `GET /openai/tasks?taskId=xxx`（仅异步）    |
| **Suno**             | `POST /suno/v2/generate`                                            | `GET /suno/v2/status?taskId=xxx`       |
| **ElevenLabs**       | `POST /eleven/music`                                                | `GET /eleven/tasks?taskId=xxx`         |
| **Producer**         | `POST /producer/audios`                                             | `GET /producer/tasks?taskId=xxx`       |

<Tip>
  **推荐轮询间隔**：每 3-5 秒。生成的文件保留 **两周**——请及时下载，避免丢失访问权限。
</Tip>

***

## 下一步

完成首次 API 调用后，探索更多功能：

* [API 介绍](introduction) — 全部服务概览
* [Hub 优质 AI 网关](api-reference/hub/introduction) — 一个端点，多种优质模型（Nano Banana、Veo 3.1、Kling v3、WAN 2.7、Seedance 2.0、ElevenLabs Music 等）
* [Gemini 视频与图像](api-reference/gemini/introduction) — Veo 2/3/3.1 视频与 Nano Banana 图像生成
* [Gemini 兼容（官方 SDK）](api-reference/gemini/compat-introduction) — 使用 Google `@google/genai` SDK 接入 Mountsea
* [🚧 Sora2 视频](api-reference/sora/introduction) — **当前不可用**
* [XAI (Grok)](api-reference/xai/introduction) — Grok 图像与视频生成
* [OpenAI GPT Image](api-reference/openai/introduction) — GPT Image 2 生成与编辑（异步 + 官方 `openai` SDK 兼容）
* [Suno 音乐](api-reference/suno/introduction) — 音乐生成、声音角色、自定义模型与音频处理
* [ElevenLabs 音乐](api-reference/eleven/introduction) — AI 音乐，含作曲计划、视频配乐与音轨分离
* [Producer 音乐](api-reference/producer/introduction) — 基于 Lyria 3 Pro 的 AI 音乐生成
* [Chat LLM 网关](api-reference/chat/introduction) — 多协议 AI 对话，支持 Claude Code

## 需要帮助？

如遇问题：

* 查阅详细的 [API 文档](api-reference/gemini/introduction) 了解端点规格
* 联系[支持团队](https://offoff.ai)获取帮助
* 阅读 [API 介绍](introduction) 获取完整功能概览

***

*准备好构建精彩的 AI 应用了吗？立即开始使用 Mountsea AI！*
