跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.ominiapi.com/llms.txt

Use this file to discover all available pages before exploring further.

聊天 (Chat) - Responses 格式 (原生 OpenAI)

OpenAI Responses API,用于创建模型响应。支持多轮对话、工具调用、推理等功能。
  • 接口地址: POST /v1/responses
  • 基础 URL (示例): https://www.ominiapi.com

认证与请求头 (Headers)

  • Authorization (必选): 使用 Bearer Token 认证。格式: Bearer sk-xxxxxx
  • Content-Type: application/json

请求参数 (Request Body)

参数名类型必选说明
modelString模型名称
inputString / ArrayObject输入内容,可以是字符串或消息数组
instructionsString系统指令或系统提示词
max_output_tokensInteger最大输出 Token 数量
temperatureNumber采样温度
top_pNumber核采样参数
streamBoolean是否启用流式响应
toolsArrayObject可调用的工具列表
tool_choiceString / Object工具选择模式控制
reasoningObject推理相关配置
previous_response_idString上一轮响应的 ID,用于延续对话上下文
truncationString截断策略,可选值: auto, disabled

示例代码 (cURL)

curl -X POST "[https://www.ominiapi.com/v1/responses](https://www.ominiapi.com/v1/responses)" \
  -H "Authorization: Bearer <您的_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": "你好,请自我介绍一下。"
  }'

响应体结构 (Response - 200 OK)

成功请求返回 JSON 格式结果。
{
  "id": "string",
  "object": "response",
  "created_at": 0,
  "status": "completed",
  "model": "string",
  "output": [
    {
      "type": "string",
      "id": "string",
      "status": "string",
      "role": "string",
      "content": [
        {
          "type": "string",
          "text": "string"
        }
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 0,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0
    }
  }
}