Assistants
- GETList assistants
- POSTCreate assistant
- GETRetrieve assistant
- POSTModify assistant
- DELDelete assistant
- POSTCreate thread
- POSTCreate thread and run
- GETRetrieve thread.
- POSTModify thread
- DELDelete thread
- GETList messages
- POSTCreate message
- GETRetrieve message
- POSTModify message
- DELDelete message
- GETList runs
- POSTCreate run
- GETRetrieve run
- POSTModify run
- POSTCancel run
- GETList run steps
- GETRetrieve run step
- POSTThe run step object
Chat
Completions
Embeddings
Evals
Files
Fine-tuning
- GETList checkpoint permissions
- POSTCreate checkpoint permissions
- DELDelete checkpoint permission
- GETList your organization's fine-tuning jobs
- POSTCreate a fine-tuning job
- GETRetrieve fine-tuning job
- POSTImmediately cancel a fine-tune job.
- GETList checkpoints for a fine-tuning job.
- GETGet status updates for a fine-tuning job.
Moderations
API Reference
Audit Logs
Certificates
Usage
Projects
- GETReturns a list of projects.
- POSTCreate project
- GETRetrieves a project.
- POSTModify project
- GETList project API keys
- GETRetrieve project API key
- DELDelete project API key
- POSTArchive project
- GETList project rate limits
- POSTUpdate project rate limit
- GETList project service accounts
- POSTCreate project service account
- GETRetrieve project service account
- DELDelete project service account
- GETReturn project users
- POSTCreate project user
- GETRetrieve project user
- POSTModify project user
- DELDelete project user
Responses
Vector stores
- GETReturns a list of vector stores.
- POSTCreate a vector store.
- GETRetrieves a vector store.
- POSTModifies a vector store.
- DELDelete a vector store.
- POSTCreate a vector store file batch.
- GETRetrieves a vector store file batch.
- POSTCancel vector store file batch
- GETReturns a list of vector store files in a batch.
- GETReturns a list of vector store files.
- POSTCreate vector store file
- GETRetrieves a vector store file.
- POSTUpdate attributes on a vector store file.
- DELDelete vector store file
- GETRetrieve vector store
- POSTSearch vector store
Chat
Create chat completion
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.
POST
/
chat
/
completions
Copy
Ask AI
curl --request POST \
--url https://api.openai.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"metadata": {},
"temperature": 1,
"top_p": 1,
"user": "user-1234",
"service_tier": "auto",
"messages": [
{
"content": "<string>",
"role": "developer",
"name": "<string>"
}
],
"model": "gpt-4o",
"modalities": [
"text"
],
"reasoning_effort": "medium",
"max_completion_tokens": 123,
"frequency_penalty": 0,
"presence_penalty": 0,
"web_search_options": {
"user_location": {
"type": "approximate",
"approximate": {
"country": "<string>",
"region": "<string>",
"city": "<string>",
"timezone": "<string>"
}
},
"search_context_size": "medium"
},
"top_logprobs": 10,
"response_format": {
"type": "text"
},
"audio": {
"voice": "ash",
"format": "wav"
},
"store": false,
"stream": false,
"stop": "\n",
"logit_bias": null,
"logprobs": false,
"max_tokens": 123,
"n": 1,
"prediction": {
"type": "content",
"content": "<string>"
},
"seed": 0,
"stream_options": null,
"tools": [
{
"type": "function",
"function": {
"description": "<string>",
"name": "<string>",
"parameters": {},
"strict": false
}
}
],
"tool_choice": "none",
"parallel_tool_calls": true,
"function_call": "none",
"functions": [
{
"description": "<string>",
"name": "<string>",
"parameters": {}
}
]
}'
Copy
Ask AI
{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 123,
"message": {
"content": "<string>",
"refusal": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"annotations": [
{
"type": "url_citation",
"url_citation": {
"end_index": 123,
"start_index": 123,
"url": "<string>",
"title": "<string>"
}
}
],
"role": "assistant",
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"audio": {
"id": "<string>",
"expires_at": 123,
"data": "<string>",
"transcript": "<string>"
}
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
],
"refusal": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
}
],
"created": 123,
"model": "<string>",
"service_tier": "auto",
"system_fingerprint": "<string>",
"object": "chat.completion",
"usage": {
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
}
}
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
application/json
Response
200
application/json
OK
Represents a chat completion response returned by model, based on the provided input.
Was this page helpful?
Copy
Ask AI
curl --request POST \
--url https://api.openai.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"metadata": {},
"temperature": 1,
"top_p": 1,
"user": "user-1234",
"service_tier": "auto",
"messages": [
{
"content": "<string>",
"role": "developer",
"name": "<string>"
}
],
"model": "gpt-4o",
"modalities": [
"text"
],
"reasoning_effort": "medium",
"max_completion_tokens": 123,
"frequency_penalty": 0,
"presence_penalty": 0,
"web_search_options": {
"user_location": {
"type": "approximate",
"approximate": {
"country": "<string>",
"region": "<string>",
"city": "<string>",
"timezone": "<string>"
}
},
"search_context_size": "medium"
},
"top_logprobs": 10,
"response_format": {
"type": "text"
},
"audio": {
"voice": "ash",
"format": "wav"
},
"store": false,
"stream": false,
"stop": "\n",
"logit_bias": null,
"logprobs": false,
"max_tokens": 123,
"n": 1,
"prediction": {
"type": "content",
"content": "<string>"
},
"seed": 0,
"stream_options": null,
"tools": [
{
"type": "function",
"function": {
"description": "<string>",
"name": "<string>",
"parameters": {},
"strict": false
}
}
],
"tool_choice": "none",
"parallel_tool_calls": true,
"function_call": "none",
"functions": [
{
"description": "<string>",
"name": "<string>",
"parameters": {}
}
]
}'
Copy
Ask AI
{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 123,
"message": {
"content": "<string>",
"refusal": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"annotations": [
{
"type": "url_citation",
"url_citation": {
"end_index": 123,
"start_index": 123,
"url": "<string>",
"title": "<string>"
}
}
],
"role": "assistant",
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"audio": {
"id": "<string>",
"expires_at": 123,
"data": "<string>",
"transcript": "<string>"
}
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
],
"refusal": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
}
],
"created": 123,
"model": "<string>",
"service_tier": "auto",
"system_fingerprint": "<string>",
"object": "chat.completion",
"usage": {
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
}
}
}
Assistant
Responses are generated using AI and may contain mistakes.