Skip to main content
POST
/
v1
/
chat
/
completions
Create chat completion
curl --request POST \
  --url https://router.requesty.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "openai/gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "<string>",
      "name": "<string>"
    }
  ],
  "max_tokens": 123,
  "temperature": 123,
  "top_p": 123,
  "stream": true,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": {}
      }
    }
  ],
  "tool_choice": "<string>",
  "response_format": {}
}'
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "model": "<string>",
  "usage": {
    "completion_tokens": 123,
    "completion_tokens_details": {
      "reasoning_tokens": 123
    },
    "prompt_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "caching_tokens": 123
    },
    "total_tokens": 123,
    "cost": 123
  },
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "user",
        "content": "<string>",
        "name": "<string>"
      },
      "finish_reason": "<string>"
    }
  ]
}

PDF Support

Send PDFs using the file_input content type:
curl https://router.requesty.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "anthropic/claude-sonnet-4-20250514",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Summarize this PDF"
          },
          {
            "type": "file_input",
            "filename": "document.pdf",
            "file_data": "<base64-encoded-pdf-data>"
          }
        ]
      }
    ]
  }'

Parameters

  • type: Must be "file_input"
  • filename: The name of the PDF file (e.g., "document.pdf")
  • file_data: Base64-encoded PDF content

Authorizations

Authorization
string
header
required

API key for authentication

Body

application/json
messages
object[]
required

An array of message objects with role and content

model
string
default:openai/gpt-4o-mini

The model name. If omitted, defaults to openai/gpt-4o-mini.

Example:

"openai/gpt-4o-mini"

max_tokens
integer

Maximum number of tokens to generate

temperature
number

Controls randomness of the output

top_p
number

Controls diversity of the output

stream
boolean

Enable Server-Sent Events (SSE) streaming responses

tools
object[]

Available tools for function calling

tool_choice
string

Specifies how tool calling should be handled

response_format
object

For structured responses (some models only)

Response

Chat completion response

id
string
required

Unique identifier for the completion

object
string
required

Object type

created
integer
required

Timestamp of creation

model
string
required

Model used for completion

choices
object[]
required
usage
object
I