Skip to main content
POST
/
v1
/
chat
/
completions
curl https://router.requesty.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "openai/gpt-4o-mini",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "What is an LLM gateway?"
      }
    ],
    "max_tokens": 1024,
    "temperature": 0.7
  }'
{
  "id": "chatcmpl-abc123def456",
  "object": "chat.completion",
  "created": 1748200000,
  "model": "openai/gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "An LLM gateway is a unified API layer that routes requests to multiple large language model providers. It normalizes different API formats, handles failover, load balancing, and provides centralized monitoring and cost tracking across providers like OpenAI, Anthropic, Google, and others."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 52,
    "total_tokens": 76,
    "cost": 0.000038
  }
}
curl https://router.requesty.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "openai/gpt-4o-mini",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "What is an LLM gateway?"
      }
    ],
    "max_tokens": 1024,
    "temperature": 0.7
  }'
{
  "id": "chatcmpl-abc123def456",
  "object": "chat.completion",
  "created": 1748200000,
  "model": "openai/gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "An LLM gateway is a unified API layer that routes requests to multiple large language model providers. It normalizes different API formats, handles failover, load balancing, and provides centralized monitoring and cost tracking across providers like OpenAI, Anthropic, Google, and others."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 52,
    "total_tokens": 76,
    "cost": 0.000038
  }
}
Enable real-time web search by adding { "type": "web_search" } to the tools array. Requesty translates this to each provider’s native web search format automatically.
{
  "model": "anthropic/claude-sonnet-4-20250514",
  "messages": [
    { "role": "user", "content": "What are the latest news in London today?" }
  ],
  "tools": [{ "type": "web_search" }],
  "stream": true
}
Works with Anthropic, Vertex/Gemini, OpenAI, xAI, and Perplexity models. See the Web Search guide for response format details and provider-specific behavior.

PDF Support

Send PDFs using the input_file content type. You can provide the PDF as either base64-encoded data or a URL.

Using Base64-Encoded PDF

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": "input_file",
            "filename": "document.pdf",
            "file_data": "data:application/pdf;base64,<base64-encoded-pdf-data>"
          }
        ]
      }
    ]
  }'

Using PDF URL

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": "input_file",
            "filename": "document.pdf",
            "file_data": "https://example.com/document.pdf"
          }
        ]
      }
    ]
  }'

Parameters

  • type: Must be "input_file"
  • filename: The name of the PDF file (e.g., "document.pdf")
  • file_data: Either base64-encoded PDF content or a URL to the PDF file

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 the model. Supports function tools for custom function calling and web_search for real-time web search.

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
Last modified on June 8, 2026