Skip to main content
POST
/
v1
/
chat
/
completions
claude-opus-4-1-20250805 (text to text)
curl --request POST \
  --url https://api.example.com/v1/chat/completions
Claude’s openai format for the text to text API.
curl -X POST "https://gptproto.com/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "claude-opus-4-1-20250805",
  "messages": [
    {
      "role": "user",
      "content": "Who are you?"
    }
  ],
  "max_tokens": 1024,
  "stream": false
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Parameters

ParameterTypeRequiredDefaultRangeDescription
modelstring✅ Yesclaude-opus-4-1-20250805-The model to use for the request. claude-opus-4-1-20250805
messagesarray✅ Yes--Array of message objects for the conversation. Each message must have a role (user/assistant) and content (string or array of content blocks)
max_tokensinteger✅ Yes-1-32000Maximum number of tokens to generate in the response
temperaturenumber❌ No1.00.0-2.0Controls randomness in output. Use lower values (closer to 0.0) for analytical tasks, higher values (closer to 2.0) for creative tasks
top_pnumber❌ No-0.0-1.0Nucleus sampling threshold. Controls diversity by considering only tokens with cumulative probability up to top_p. Recommended for advanced use only. Do not use with temperature
top_kinteger❌ No->0Only sample from the top K options for each token. Removes low probability responses. Recommended for advanced use only
streamboolean❌ Nofalse-Whether to stream the response incrementally using server-sent events
stoparray❌ No-Max 8191 sequencesCustom text sequences that will cause the model to stop generating. Each sequence must contain non-whitespace characters
presence_penaltynumber❌ No0-2.0 to 2.0Positive values penalize new tokens based on whether they appear in the text so far
frequency_penaltynumber❌ No0-2.0 to 2.0Positive values penalize new tokens based on their existing frequency in the text so far

Messages Array Structure

Each message object in the messages array should have the following structure:
FieldTypeRequiredRangeDescription
rolestring✅ Yes-The role of the message. Can be: user or assistant
contentarray/string✅ Yes-The content of the message. Can be a simple string for text-only messages, or an array of content blocks for multimodal content

Content Block Structure (when content is an array)

FieldTypeRequiredRangeDescription
typestring✅ Yes-Must be text
textstring✅ Yes-The text content