English
  • English
  • 简体中文
  1. OpenAI
English
  • English
  • 简体中文
  • 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
    • o3-pro
      POST
  • Gemini
    • gemini
      POST
  1. OpenAI

Chat

Developing
POST
{{base_url}}/v1/chat/completions
Request Request Example
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": "gpt-4o-mini-2024-07-18",
  "temperature": 0.5,
  "messages": [
    {
      "role": "user",
      "content": "hello"
    }
  ],
  "stream": false
}'
Response Response Example
{
    "id": "chatcmpl-9vyopQa0CKV5AO3JJzYtyaYeK73lk",
    "object": "chat.completion",
    "created": 1723605511,
    "model": "gpt-4o-mini-2024-07-18",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Hello! How can I assist you today?",
                "refusal": null
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 8,
        "completion_tokens": 9,
        "total_tokens": 17
    },
    "system_fingerprint": "fp_48196bc67a"
}

Request

Header Params

Body Params text/plain
Examples

Responses

🟢200成功
application/json
Body

Modified at 2025-06-04 09:32:27
Previous
OpenAI
Next
Chat (o1,o3,o4 series model)
Built with