Skip to main content
POST
/
v1
/
chat
/
completions
Chat Completion
curl --request POST \
  --url https://www.anyfast.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "grok-3",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "max_tokens": 2,
  "temperature": 1,
  "top_p": 0.5,
  "stream": false
}
'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "grok-3",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "<string>"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required

Model ID

Available options:
grok-3
Example:

"grok-3"

messages
object[]
required

A list of messages comprising the conversation so far.

Minimum array length: 1
Example:
[{ "role": "user", "content": "Hello!" }]
max_tokens
integer

The maximum number of tokens to generate.

Required range: x >= 1
temperature
number
default:1

Sampling temperature.

Required range: 0 <= x <= 2
Example:

1

top_p
number

Nucleus sampling threshold.

Required range: 0 <= x <= 1
stream
boolean
default:false

If true, stream partial message deltas using SSE.

Response

Completion generated successfully

id
string
object
string
Example:

"chat.completion"

created
integer
model
string
Example:

"grok-3"

choices
object[]
usage
object