Skip to main content
POST
Create a chat completion

Authorizations

Authorization
string
header
required

A key from https://fastrun.si/dashboard/keys (starts with fr_).

Body

application/json
model
string
required

Model ID. See Models.

Example:

"google/gemma-4-31b-it"

messages
object[]
required

The conversation so far, oldest first.

Minimum array length: 1
stream
boolean
default:false

Send the answer as server-sent events while it is generated. See Streaming.

stream_options
object

Options for streamed responses.

max_tokens
integer

Maximum number of tokens to generate.

Required range: 1 <= x <= 16384
temperature
number

Sampling temperature. Higher is more random; 0 is greedy.

Required range: 0 <= x <= 2
top_p
number

Nucleus sampling. Considers the smallest set of tokens whose probabilities add up to top_p.

Required range: 0 <= x <= 1
top_k
integer

Considers only the top_k most likely tokens. 0 turns it off.

Required range: 0 <= x <= 1000
min_p
number

Drops tokens less likely than min_p times the most likely token.

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

Penalizes tokens by how often they already appeared.

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

Penalizes tokens that already appeared at all.

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

Multiplicative penalty on repeated tokens. 1 turns it off.

Required range: 0 <= x <= 2
stop

Up to 4 sequences where generation stops. The stop sequence is not included in the output.

seed
integer

Seed for sampling.

Required range: 0 <= x <= 2147483647
logprobs
boolean
default:false

Return the log probability of each output token.

top_logprobs
integer

With logprobs, also return this many most likely alternatives at each position.

Required range: 0 <= x <= 20
tools
object[]

Functions the model may call. See Tool calling.

tool_choice

auto (default when tools is set) lets the model decide, none turns tools off, required forces a call, and an object names the function to call.

Available options:
none,
auto,
required
response_format
Text · object

Constrain the output to JSON. See Structured outputs.

reasoning_effort
enum<string>

Turns the model's thinking on (low, medium, high) or off (none). Off when omitted. See Reasoning.

Available options:
none,
low,
medium,
high
chat_template_kwargs
object

Extra variables for the model's chat template, such as {"enable_thinking": true}. See Reasoning.

Response

The completion. With stream: true the body is a text/event-stream of chat.completion.chunk events ending with data: [DONE].

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

Unix time in seconds.

model
string
choices
object[]
usage
object