示例项目
  1. OpenAI
示例项目
  • Introduction (Must Read)
  • OpenAI official library usage tutorial
  • Obtain Base URL and API Key
  • OpenAI
    • Chat
      POST
    • Chat (o1,o3,o4 series model)
      POST
    • dall--e-3
      POST
    • gpt-image-1
      POST
    • Image edit
      POST
    • Analyze image
      POST
    • Analyze PDF
      POST
  • Gemini
    • gemini
      POST
  1. OpenAI

Chat (o1,o3,o4 series model)

开发中
POST
{{base_url}}/v1/chat/completions

请求参数

Header 参数
Content-Type
string 
可选
示例值:
application/json
Authorization
string 
可选
示例值:
sk-shdahd【You ApiKey】
Body 参数application/json
model
string 
模型
必需
o1-mini,o1-preview
messages
array [object {2}] 
必需
role
string 
角色 不支持 system角色
可选
content
string 
提问消息
可选
max_completion_tokens
integer 
最大回复
必需
stream
boolean 
流式输出
必需
示例
{
    "model": "o1-mini",
    "messages": [
        {
            "role": "user",
            "content": "晚上好"
        }
    ],
    "max_tokens": 1688,
    "temperature": 0.5,
    "stream": false
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location -g --request POST '{{base_url}}/v1/chat/completions' \
--header 'Authorization: sk-shdahd【You ApiKey】' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "o1-mini",
    "messages": [
        {
            "role": "user",
            "content": "晚上好"
        }
    ],
    "max_tokens": 1688,
    "temperature": 0.5,
    "stream": false
}'

返回响应

🟢200成功
application/json
Body
object {0}
示例
{
    "id": "chatcmpl-A1iMgDLzZtUJ9QDpfqDLxKH0zfUnp",
    "object": "chat.completion",
    "created": 1724972230,
    "model": "o1-mini",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "晚上好!有什么我可以帮你的吗?",
                "refusal": null
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 9,
        "completion_tokens": 10,
        "total_tokens": 19
    },
    "system_fingerprint": "fp_157b3831f5"
}
修改于 2025-06-04 09:33:00
上一页
Chat
下一页
dall--e-3
Built with