Skip to main content
POST
/
v1
/
chat
/
completions
curl --request POST \
  --url https://api.foxapi.cc/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": "Write a quicksort algorithm in Python"
    }
  ]
}
'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1757165031,
  "model": "<string>",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 50,
    "total_tokens": 60
  }
}

Authorizations

Authorization
string
header
required

All APIs require Bearer Token authentication

Add to request header:

Authorization: Bearer YOUR_API_KEY

Body

application/json
model
string
required

Model name, e.g. gpt-4o, deepseek-chat, etc.

Example:

"gpt-4o"

messages
object[]
required

List of messages in the conversation

stream
boolean
default:false

Whether to stream the response

temperature
number

Sampling temperature (0-2)

Required range: 0 <= x <= 2
max_tokens
integer

Maximum number of tokens to generate

top_p
number

Nucleus sampling parameter (0-1)

Required range: 0 <= x <= 1
frequency_penalty
number

Penalize new tokens based on their frequency in the text so far (-2 to 2)

Required range: -2 <= x <= 2
presence_penalty
number

Penalize new tokens based on whether they appear in the text so far (-2 to 2)

Required range: -2 <= x <= 2
tools
object[]

A list of tools the model may call

tool_choice

Controls which tool is called by the model

Available options:
none,
auto,
required
response_format
object

An object specifying the format that the model must output

stop

Up to 4 sequences where the API will stop generating further tokens

n
integer

How many chat completion choices to generate for each input message

Required range: x >= 1

Response

Chat completion response

id
string

Unique completion ID

Example:

"chatcmpl-abc123"

object
enum<string>

Object type

Available options:
chat.completion
created
integer

Creation timestamp

Example:

1757165031

model
string

Model used

choices
object[]
usage
object

Token usage statistics