OpenAI Request Builder

Build OpenAI Chat Completions API request payloads and cURL commands.

JSON Request Body
{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1024
}
cURL Command
curl -X POST '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!"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1024
}'
Endpointhttps://api.openai.com/v1/chat/completions

Related Tools

Learn More

FAQ

What endpoint does OpenAI use for chat?
The OpenAI Chat Completions endpoint is https://api.openai.com/v1/chat/completions. Authentication uses a Bearer token in the Authorization header.
What is the messages format for OpenAI?
OpenAI expects a messages array where each object has a role (system, user, or assistant) and a content string.
Is my OpenAI API key stored?
No. The builder uses a placeholder $OPENAI_API_KEY variable. Your actual key is never entered or stored here.

Generate ready-to-use JSON request bodies and cURL commands for the OpenAI Chat Completions API. Select a GPT model, configure temperature and max_tokens, compose messages, and copy the formatted payload or cURL command.