Skip to main content
POST
/
v1
/
chat
/
completions
o4-mini (Text to Text (Chat))
curl --request POST \
  --url https://api.example.com/v1/chat/completions

API Key Authentication

GPTProto API uses Bearer token authentication. All API requests must include your API key (sk-xxxxx) in the Authorization header.

Getting Your API Key

  1. Sign up for a GPTProto account at https://gptproto.com
  2. Navigate to the API Keys section in your dashboard
  3. Generate a new API key
  4. Copy and securely store your API key For authentication details, please refer to the Authentication section.

Initiate Request

curl --location --request POST 'https://gptproto.com/v1/chat/completions' \
--header 'Authorization: GPTPROTO_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "o4-mini",
  "messages": [
    {
      "role": "user",
      "content": "Who are you?"
    }
  ],
  "stream": false
}'

Response Example

{
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "content": "I am an AI language model created by OpenAI, designed to assist with a wide range of questions and tasks by providing information and generating text based on the input I receive. How can I assist you today?",
                "role": "assistant"
            }
        }
    ],
    "created": 1765782288,
    "id": "chatcmpl-adbc",
    "model": "o4-mini",
    "object": "chat.completion",
    "system_fingerprint": "fp_83554c687e",
    "usage": {
        "completion_tokens": 42,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 0,
            "reasoning_tokens": 0,
            "rejected_prediction_tokens": 0
        },
        "prompt_tokens": 11,
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0
        },
        "total_tokens": 53
    }
}

Parameters

Core Parameters

ParameterTypeRequiredDefaultRangeDescription
modelstring✅ Yes--Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.
messagesarray✅ Yes--A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, images, and audio.
>messages.rolestring✅ Yes-developer
user
system
The role of the messages author.
>messages.namestring❌ No--An optional name for the participant. Provides the model information to differentiate between participants of the same role.
>messages.contentstring / array✅ Yes--The contents of the developer message.
>>messages.content.typestring✅ Yes-text
image_url
The type of the content part
>>messages.content.textstring❌ No--The text content
>>messages.content.image_urlobject❌ No--The image URL content
>>messages.content.image_url.urlstring❌ No--The URL of the image

Advanced Parameters

ParameterTypeRequiredDefaultRangeDescription
max_completion_tokensinteger / null❌ No--An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
streamboolean❌ Nofalsetrue
false
Whether to stream the response back incrementally. Defaults to false.

Error Codes

Common Error Codes

Error CodeError NameDescription
401UnauthorizedAPI key is missing or invalid
403ForbiddenYour API key doesn’t have permission to access this resource, or insufficient balance for the requested operation
429Too Many RequestsYou’ve exceeded your rate limit
500Internal server errorAn internal server error occurred
503Content policy violationContent blocked due to safety concerns (actual status code is 400)