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": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  },
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "user",
        "content": "<string>",
        "name": "<string>"
      },
      "finish_reason": "<string>"
    }
  ]
}

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