Turbocharged version of GPT-3.5, enhancing speed and efficiency
Artificial Analysis Quality Index; Higher is better
Output Tokens per Second; Higher is better
USD per 1M Tokens; Lower is better
Seconds to First Tokens Chunk Received; Lower is better
API keys
The OpenAI API uses API keys for authentication. You can create API keys at a user or service account level. Service accounts are tied to a "bot" individual and should be used to provision access for production systems. Each API key can be scoped to one of the following,
1
Authorization: Bearer OPENAI_API_KEY
Organizations and projects (optional)
For users who belong to multiple organizations or are accessing their projects through their legacy user API key, you can pass a header to specify which organization and project is used for an API request. Usage from these API requests will count as usage for the specified organization and project.
To access the Default project
in an organization, leave out the OpenAI-Project
header
Example curl command:
1
2
3
4
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Organization: YOUR_ORG_ID" \
-H "OpenAI-Project: $PROJECT_ID"
Example with the `openai` Python package:
1
2
3
4
5
6
from openai import OpenAI
client = OpenAI(
organization='YOUR_ORG_ID',
project='$PROJECT_ID',
)
Example with the `openai` Node.js package:
1
2
3
4
5
6
import OpenAI from "openai";
const openai = new OpenAI({
organization: "YOUR_ORG_ID",
project: "$PROJECT_ID",
});
Organization IDs can be found on your Organization settings page. Project IDs can be found on your General settings page by selecting the specific project.
Generate AI responses for conversations using text, images, and audio.
Request body
The conversation history as a series of messages. Supports various formats including text, images, and audio based on model capabilities.
The specific model to be used for generating responses. Check compatibility guide for available models.
Choose whether to save this chat for model improvement purposes. Default is false.
Adjust from -2 to 2 to control repetition. Positive values reduce word repetition. Default is 0.
Set between -2 and 2 to influence topic variety. Positive values encourage new topics. Default is 0.
Controls response randomness (0-2). Higher for more creative, lower for more focused replies. Default is 1.
Alternative to temperature. Sets probability threshold for token selection. Example: 0.1 means top 10% probable tokens. Default is 1.
Enable real-time response streaming, similar to ChatGPT. Default is false.
Specify output format. Supports JSON structure for formatted responses. Available on newer models.
Set for consistent responses across multiple calls. Results may still vary slightly.
Unique identifier for tracking end-user interactions and monitoring system usage.
curl https://api.openai.com/v1/chat/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer $OPENAI_API_KEY"
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-4o-mini",
"system_fingerprint": "fp_44709d6fcb",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "
Hello there, how may I assist you today?",
},
"logprobs": null,
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21,
"completion_tokens_details": {
"reasoning_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
}
}