OpenModelOpenModel
API 参考

Responses 协议

通过 OpenAI Responses API 格式访问 OpenAI 和 DashScope 模型。

迁移提示: Chat Completions API(/v1/chat/completions)已被移除。OpenModel 在 POST /v1/responses 提供 Responses 协议,不提供可接受任意 OpenAI API 格式的通用端点。迁移客户端时必须改用 Responses 请求格式,不能只替换 URL。

Responses 协议以 OpenAI Responses API 格式暴露在 POST /v1/responses。它服务两家供应商:OpenAI 和 DashScope(阿里云百炼 Qwen 模型)。

由于两家供应商共享相同的端点与请求结构,你对它们都使用 OpenAI SDK——切换供应商只需更改 model 参数。安装与完整示例参见 OpenAI SDK 指南。

端点

POST https://api.openmodel.ai/v1/responses

同一 Base URL 也提供供 OpenAI SDK 使用的鉴权模型列表端点 GET /v1/models(参见模型)。

认证

将 OpenModel API 密钥作为 Bearer 令牌传入:

Authorization: Bearer om-your-api-key

切换供应商

要切换到不同的供应商,只需更改 model 参数:

# OpenAI
client.responses.create(model="gpt-5.4", input="...")
# DashScope(Qwen)
client.responses.create(model="qwen3-max", input="...")

DashScope 同时支持 Messages 协议——选择与你现有代码匹配的即可。

供应商差异与在线试用

在下方选择供应商,即可查看其示例模型、错误响应格式,以及预填了该供应商模型的交互式 playground。

示例模型
gpt-4ogpt-4.1-mini
错误响应格式
标准 OpenAI 格式——错误体携带 error.code + error.type。这是所有 Responses provider 的对比基准。

以上为示例模型,可用列表可能变更。前往控制台查看全部可用模型

POST
/v1/responses

授权

BearerAuth
授权Bearer <token>

在请求中包含您的 API 密钥:Authorization: Bearer om-your-api-key

位置: header

请求体

application/json

TypeScript 类型定义

在 TypeScript 中使用 request body 类型。

响应体

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/responses" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-5.5",    "input": "Explain how API gateways work in 3 sentences."  }'
{
  "id": "resp_67ccf18ef5fc8190b16dbee19bc54e5f",
  "object": "response",
  "created_at": 1741484430,
  "model": "gpt-5.5",
  "output": [
    {
      "type": "message",
      "id": "msg_67ccf18ef5fc8190b16dbee19bc54e60",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "An API gateway acts as a single entry point for client requests, routing them to the appropriate backend services."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 18,
    "output_tokens": 52,
    "total_tokens": 70
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string"
  }
}
示例模型
qwen3.7-maxqwen3.6-plusqwen3.6-max-previewqwen3.6-flashqwen3-max
错误响应格式
Messages 端点返回 DashScope 的原生错误格式——根级 code/type,不带 error 包装。 Responses 端点则使用标准的 error.code + error.type 结构。

以上为示例模型,可用列表可能变更。前往控制台查看全部可用模型

POST
/v1/responses

授权

BearerAuth
授权Bearer <token>

在请求中包含您的 API 密钥:Authorization: Bearer om-your-api-key

位置: header

请求体

application/json

TypeScript 类型定义

在 TypeScript 中使用 request body 类型。

响应体

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/responses" \  -H "Content-Type: application/json" \  -d '{    "model": "qwen3-max",    "input": "Explain how API gateways work in 3 sentences."  }'
{
  "id": "resp_67ccf18ef5fc8190b16dbee19bc54e5f",
  "object": "response",
  "created_at": 1741484430,
  "model": "qwen3-max",
  "output": [
    {
      "type": "message",
      "id": "msg_67ccf18ef5fc8190b16dbee19bc54e60",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "An API gateway acts as a single entry point for client requests, routing them to the appropriate backend services."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 18,
    "output_tokens": 52,
    "total_tokens": 70
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string"
  }
}

本页目录