Open AI (ChatGPT)
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 Japanese
  • 🇵🇹 Portuguese
  • 🇰🇷 Korea
  • 🇩🇪 German
  1. Chat
Open AI (ChatGPT)
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 Japanese
  • 🇵🇹 Portuguese
  • 🇰🇷 Korea
  • 🇩🇪 German
  • README
  • Introduction
  • Authentication
  • Making requests
  • Streaming
  • Debugging requests
  • Backward compatibility
  • Administration
  • Chat
    • Create chat completion
      POST
    • Get chat completion
      GET
    • Get chat messages
      GET
    • List Chat Completions
      GET
    • Update chat completion
      POST
    • Delete chat completion
      DELETE
  • Audio
    • Create speech
      POST
    • Create transcription
      POST
    • Create translation
      POST
  • Images
    • README
    • Create image
      POST
    • Create image edit
      POST
    • Create image variation
      POST
  • Embeddings
    • Create embeddings
      POST
  • Fine-tuning
    • Create fine-tuning job
      POST
    • List fine-tuning jobs
      GET
    • List fine-tuning events
      GET
    • List fine-tuning checkpoints
      GET
    • Retrieve fine-tuning job
      GET
    • Cancel fine-tuning
      POST
  • Batch
    • Create batch
    • Retrieve batch
    • Cancel batch
    • List batch
  • Files
    • README
    • Upload file
    • List files
    • Retrieve file
    • Delete file
    • Retrieve file content
  • Uploads
    • Create upload
    • Add upload part
    • Complete upload
  • Models
    • List models
    • Retrieve model
    • Delete a fine-tuned model
  • Moderations
    • Create moderation
  • Invites
    • List invites
    • Create invite
    • Retrieve invite
    • Delete invite
  • Users
    • List users
    • Modify user
    • Retrieve user
  • Projects
    • List projects
    • Create project
    • Retrieve project
    • Modify project
    • Archive project
  • Project users
    • List project users
    • Create project user
    • Retrieve project user
    • Modify project user
    • Delete project user
  • Project service accounts
    • List project service accounts
    • Create project service account
    • Retrieve project service account
    • Delete project service account
  • Project API keys
    • List project API keys
    • Retrieve project API key
    • Delete project API key
  • Project rate limits
    • List project rate limits
    • Modify project rate limit
  • Usage
    • Completions
    • Embeddings
    • Moderations
    • Images
    • Audio speeches
    • Audio transcriptions
    • Vector stores
    • Code interpreter sessions
    • Costs
  • Assistants (v1)
    • Create assistant
    • List assistants
    • Delete assistant
    • Modify assistant
    • Retrieve assistant
    • Create assistant file (v1)
    • List assistant files (v1)
    • Retrieve assistant file (v1)
    • Delete assistant file (v1)
  1. Chat

Create chat completion

POST
/chat/completions
Starting a new project? We recommend trying Responses to take advantage of the latest OpenAI platform features. Compare Chat Completions with Responses.
Creates a model response for the given chat conversation. Learn more in the text generation, vision, and audio guides.
Parameter support can differ depending on the model used to generate the response, particularly for newer reasoning models. Parameters that are only supported for reasoning models are noted below. For the current state of unsupported parameters in reasoning models, refer to the reasoning guide.

Request

Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/json

Examples

Responses

🟢200OK
application/json
Body

Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "gpt-3.5-turbo",
  "messages": [{"role": "user", "content": "Hello!"}]
}'
Response Response Example
{
  "id": "chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT",
  "object": "chat.completion",
  "created": 1741569952,
  "model": "gpt-4.1-2025-04-14",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 19,
    "completion_tokens": 10,
    "total_tokens": 29,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "service_tier": "default"
}
Modified at 2025-09-17 07:21:27
Previous
Administration
Next
Get chat completion
Built with