跳转到主要内容

推荐 endpoint

最小请求

{
  "model": "gpt-4.1",
  "input": "总结 Api.Go 文档的核心价值,用 3 个要点回答。"
}

cURL 示例

curl https://mass.apigo.ai/v1/responses \
  -H "Authorization: Bearer $TIDEMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1",
    "input": "总结 Api.Go 文档的核心价值,用 3 个要点回答。"
  }'

Python 示例

from openai import OpenAI

client = OpenAI(
    base_url="https://mass.apigo.ai/v1",
    api_key="<TIDEMIND_API_KEY>",
)

response = client.responses.create(
    model="gpt-4.1",
    input="总结 Api.Go 文档的核心价值,用 3 个要点回答。",
)

print(response.output_text)

Node.js 示例

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://mass.apigo.ai/v1",
  apiKey: process.env.TIDEMIND_API_KEY,
});

const response = await client.responses.create({
  model: "gpt-4.1",
  input: "总结 Api.Go 文档的核心价值,用 3 个要点回答。"
});

console.log(response.output_text);

最佳实践

  • 新接入优先考虑 responses,因为它更适合统一文本、工具和多模态输入
  • 多轮对话尽量复用 previous_response_id,不要每轮都回传完整历史
  • 如果后面要接结构化输出或工具调用,先围绕 output[]output_text 设计解析层