Skip to main content
POST
/
chat
/
completions
curl --request POST \
--url https://api.anyapi.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5",
"messages": [
{
"role": "developer",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
]
}'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "<string>",
        "function_call": {
          "name": "<string>",
          "arguments": "<string>"
        }
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "completion_tokens": 123,
    "prompt_tokens": 123,
    "total_tokens": 123
  },
  "system_fingerprint": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Get your API key from the dashboard.

Body

application/json
model
string
required

ID of the model to use

Example:
["gpt-4.1", "gpt-5"]
messages
object[]
required

A list of messages comprising the conversation so far

Minimum length: 1
max_tokens
integer

The maximum number of tokens to generate in the chat completion

Required range: x >= 1
Example:

300

stream
boolean
default:false

If set, partial message deltas will be sent as data-only server-sent events

tools
object[]

A list of tools the model may call

tool_choice
default:auto

Controls which (if any) tool is called by the model

Available options:
none,
auto
logprobs
boolean
default:false

Whether to return log probabilities of the output tokens

top_logprobs
integer

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position

Required range: 0 <= x <= 20

Response

Successful response

id
string
required

A unique identifier for the chat completion

object
enum<string>
required
Available options:
chat.completion
created
integer
required

The Unix timestamp (in seconds) of when the chat completion was created

model
string
required

The model used for the chat completion

choices
object[]
required
usage
object
system_fingerprint
string

This fingerprint represents the backend configuration that the model runs with

I