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

# Responses API

***

## 💡 关于

此接口兼容 **OpenAI Responses API** 格式，这是 OpenAI 推出的新一代 API 格式。适用于：

* **Cherry Studio** 等支持 Responses API 格式的客户端
* 使用 OpenAI SDK 的 `responses.create()` 方法
* 需要简化的 input/instructions 参数格式的场景

<Info>
  **Base URL**: `https://api.mountsea.ai/chat`，与 OpenAI Chat Completions API 共用相同的 Base URL。
</Info>

***

## 💡 快速示例

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

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

    # Basic response
    response = client.responses.create(
        model="gpt-5.1",
        instructions="You are a helpful assistant.",
        input="Hello! What can you help me with?"
    )

    print(response.output_text)
    ```

    **使用消息数组输入：**

    ```python theme={null}
    response = client.responses.create(
        model="gpt-5.1",
        input=[
            {
                "role": "user",
                "content": "Tell me a joke about programming"
            }
        ]
    )

    print(response.output_text)
    ```

    **流式响应：**

    ```python theme={null}
    stream = client.responses.create(
        model="gpt-5.1",
        instructions="You are a helpful assistant.",
        input="Tell me a story",
        stream=True
    )

    for event in stream:
        if hasattr(event, 'delta'):
            print(event.delta, end="")
    ```
  </Tab>

  <Tab title="Node.js">
    ```javascript theme={null}
    import OpenAI from 'openai';

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

    // Basic response
    const response = await client.responses.create({
        model: 'gpt-5.1',
        instructions: 'You are a helpful assistant.',
        input: 'Hello! What can you help me with?'
    });

    console.log(response.output_text);
    ```

    **使用消息数组输入：**

    ```javascript theme={null}
    const response = await client.responses.create({
        model: 'gpt-5.1',
        input: [
            {
                role: 'user',
                content: 'Tell me a joke about programming'
            }
        ]
    });

    console.log(response.output_text);
    ```

    **流式响应：**

    ```javascript theme={null}
    const stream = await client.responses.create({
        model: 'gpt-5.1',
        instructions: 'You are a helpful assistant.',
        input: 'Tell me a story',
        stream: true
    });

    for await (const event of stream) {
        if (event.type === 'response.output_text.delta') {
            process.stdout.write(event.delta);
        }
    }
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.mountsea.ai/chat/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer your-api-key" \
      -d '{
        "model": "gpt-5.1",
        "instructions": "You are a helpful assistant.",
        "input": "Hello! What can you help me with?"
      }'
    ```

    **使用消息数组输入：**

    ```bash theme={null}
    curl https://api.mountsea.ai/chat/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer your-api-key" \
      -d '{
        "model": "gpt-5.1",
        "input": [
          {"role": "user", "content": "Tell me a joke"}
        ]
      }'
    ```
  </Tab>
</Tabs>

***

## 📤 响应格式

### 非流式响应

```json theme={null}
{
  "id": "resp_xxx",
  "object": "response",
  "created_at": 1234567890,
  "model": "gpt-5.1",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Hello! I can help you with all sorts of things..."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 30,
    "output_tokens": 15,
    "total_tokens": 45
  }
}
```

***

## 📱 Cherry Studio 配置

使用 Cherry Studio 接入 Responses API：

| 配置项     | 值                                  |
| ------- | ---------------------------------- |
| 服务商名称   | `MountSea AI`                      |
| API 地址  | `https://api.mountsea.ai/chat`     |
| API Key | 你的 API Key                         |
| 模型名称    | 例如 `gpt-5.1`、`claude-sonnet-4-6` 等 |

***

## 🔧 Responses API 与 Chat Completions API 对比

| 特性               | Chat Completions             | Responses API     |
| ---------------- | ---------------------------- | ----------------- |
| 端点               | `/v1/chat/completions`       | `/v1/responses`   |
| 输入格式             | `messages` 数组                | `input`（字符串或数组）   |
| 系统提示             | `messages` 中 role=system     | `instructions` 参数 |
| 响应格式             | `choices[0].message.content` | `output_text`     |
| 流式响应             | ✅                            | ✅                 |
| Function Calling | ✅                            | ✅                 |

<Tip>
  两种 API 格式都能访问所有模型。如果你使用的客户端支持 Chat Completions 格式，推荐使用 [Chat Completions](completions)。如果客户端使用 Responses 格式（如部分版本的 Cherry Studio），则使用此接口。
</Tip>

***

## 🔧 API 参考

<Info>
  以下交互式 API 表单由 OpenAPI 规范自动生成。
</Info>
