Parameters
The parameters you can pass to the chat completions endpoint, and when to use them.
Defaults Each model has its own defaults and declares which optional parameters are verified to have an effect on it. The feed at GET /v1/models is authoritative. If a parameter isn’t set, the model’s own default applies.
Quick reference
Match the problem you’re solving to the parameter most likely to help.
- Output cuts off mid-sentence: increase
max_tokens. - Need exactly one token (yes/no, class label): set
max_tokensto1. - Responses feel generic or repetitive: increase
temperature, or setfrequency_penaltyto a small positive value where supported. - Output loops on the same phrase: set
repetition_penaltyto about1.1where supported. - Answers are too slow or too verbose: lower
reasoning_efforton reasoning models. - Need the same answer every run (evals, regression tests): set
seedand use a lowtemperatureon a model that declaresseed(it doesn’t reproduce on the DeepSeek models). - Need machine-parseable output: use
response_formatwith a JSON schema. See Structured outputs. - Need token-level confidence scores: set
logprobs. See Logprobs.
Length and stopping
max_tokens
The maximum number of tokens the model is allowed to generate in the response. Shorter values return faster but risk truncating the answer mid-sentence. The value is capped by the model’s max output length.
Increase this when the model is cutting off long answers. Decrease it (sometimes to 1) when you only need a single token, like a yes/no or a class label.
Default: if omitted, the gateway applies a per-model default budget. Set it explicitly for long outputs.
stop
A string or list of strings that tell the model to stop generating as soon as one of them is produced. Useful for short, structured outputs where you know the boundary, for example a newline between rows or a closing tag.
Set it when you want the model to stop early without parsing the response yourself. Leave it unset for free-form text.
Typical default: unset.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.reka.ai/v1",
api_key=os.environ["REKA_API_KEY"],
)
response = client.chat.completions.create(
model="deepseek4-flash",
messages=[
{
"role": "user",
"content": "Classify this review as Positive or Negative: 'Loved it.'",
}
],
max_tokens=100,
stop=["\n\n"],
)
print(response.choices[0].message.content)Sampling
temperature, top_p, top_k and min_p all narrow the candidate token set. Similarly, repetition_penalty, frequency_penalty and presence_penalty all discourage repetition in different ways. In most cases, tune one parameter from each group and leave the others at their defaults rather than stacking them.
temperature and top_p work on every model. For the rest, each model’s listing declares the parameters verified to have an effect on it. Undeclared parameters are forwarded as-is and may be ignored or rejected by the backend. On OpenRouter, undeclared parameters are stripped before they reach us. See Per-model support below.
temperature
A decimal, typically between 0 and 2, that controls how random the output is. 0 always picks the highest-probability token (deterministic for a given prompt). Values closer to 1 introduce more variety. Values above 1 are usually too noisy for production workloads; the range isn’t enforced, so higher values are accepted but produce gibberish.
Lower it for extraction, classification, and other tasks where there is one right answer. Raise it for brainstorming, creative writing, or when responses feel repetitive.
Typical default: model-specific. Supported on every model.
top_p
Nucleus sampling. The model samples only from the smallest set of tokens whose cumulative probability exceeds top_p. A value of 0.9 means “only consider tokens that together make up the top 90% of probability mass.”
Use it as a softer alternative to temperature. Most users tune one or the other, not both.
Typical default: 1.0 (no truncation). Supported on every model.
top_k
Limits sampling to the k most likely next tokens. top_k=1 is greedy decoding. Larger values allow more variety.
Use it when you want a hard cap on the candidate set. Like top_p, prefer tuning either top_k or top_p, not both.
Typical default: unset (no cap). Declared on deepseek4-flash, deepseek-v4-pro, glm5.3, glm5.3-flash, qwen3.8-27b, reka-edge-2603 and reka-flash-3.
min_p
Drops any token whose probability is below min_p times the probability of the most likely token. A value of 0.05 keeps only tokens at least 5% as likely as the top candidate.
Use it as an adaptive alternative to top_p: it keeps more options when the model is uncertain and fewer when it is confident.
Typical default: 0 (disabled). Declared on qwen3.8-27b.
repetition_penalty
Reduces the probability of tokens that have already appeared anywhere in the prompt or response. Values above 1.0 discourage repetition. Values below 1.0 encourage it.
Raise it slightly (for example, 1.1) when the model loops or repeats phrases. Leave it at 1.0 otherwise, since aggressive values degrade fluency.
Typical default: 1.0. Declared on deepseek-v4-pro, glm5.3, glm5.3-flash, qwen3.8-27b.
frequency_penalty
Penalizes tokens proportionally to how often they have already appeared in the response so far. Higher positive values make the model less likely to repeat the same exact tokens. Negative values make repetition more likely. Range: -2.0 to 2.0.
Use it to reduce verbatim repetition in long generations (lists, summaries, code). It is finer-grained than repetition_penalty because the penalty scales with frequency.
Typical default: 0. Declared on deepseek-v4-pro, glm5.3, glm5.3-flash, qwen3.8-27b, reka-edge-2603 and reka-flash-3.
presence_penalty
Penalizes tokens that have appeared at all in the response so far, regardless of how many times. Higher positive values push the model toward new topics and vocabulary. Range: -2.0 to 2.0.
Use it when you want the model to cover more ground (idea generation, topic expansion) rather than circle the same concepts.
Typical default: 0. Declared on glm5.3, glm5.3-flash, qwen3.8-27b, reka-edge-2603 and reka-flash-3.
logit_bias
A map from token id to a bias between -100 and 100 added to that token’s logit before sampling. Large negative values effectively ban a token; large positive values force it.
Use it to block specific words or steer toward a fixed set of answers. Token ids are tokenizer-specific, so look them up for the model you’re calling.
Typical default: unset. Declared on qwen3.8-27b.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.reka.ai/v1",
api_key=os.environ["REKA_API_KEY"],
)
# The OpenAI SDK doesn't type these fields; pass them through extra_body.
response = client.chat.completions.create(
model="qwen3.8-27b",
messages=[{"role": "user", "content": "List ten unusual hobbies."}],
extra_body={"repetition_penalty": 1.1, "min_p": 0.05},
)
print(response.choices[0].message.content)seed
An integer that makes sampling deterministic. With the same seed, prompt, model, and parameters, the model returns the same response. Determinism is best-effort and may not hold across model or backend updates.
Set it for reproducibility in evals, regression tests, and debugging.
Typical default: unset (responses vary between calls). Declared on glm5.3, glm5.3-flash, qwen3.8-27b, reka-edge-2603, reka-flash-3. Forwarded to deepseek4-flash and deepseek-v4-pro but not reproducible there.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.reka.ai/v1",
api_key=os.environ["REKA_API_KEY"],
)
response = client.chat.completions.create(
model="deepseek4-flash",
messages=[{"role": "user", "content": "Give me one fun fact about octopuses."}],
seed=42,
temperature=0.7,
)
print(response.choices[0].message.content)Per-model support
Each model’s listing declares the parameters verified to have an effect on it. Undeclared parameters are forwarded to the backend as-is and may be ignored or rejected there. On OpenRouter, undeclared parameters are stripped before they reach us. GET /v1/models is authoritative.
| Model | temperature | top_p | max_tokens | stop | top_k | seed | frequency_penalty | presence_penalty | repetition_penalty | min_p | logit_bias |
|---|---|---|---|---|---|---|---|---|---|---|---|
deepseek4-flash | ✓ | ✓ | ✓ | ✓ | ✓ | — | — | — | — | — | — |
deepseek-v4-pro | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✓ | — | ✓ | — | — |
glm5.3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | — |
glm5.3-flash | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | — |
qwen3.8-27b | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
reka-edge-2603 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | — | — |
reka-flash-3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | — | — |
seed is forwarded to the DeepSeek models but does not reproduce there.
Reasoning
reasoning_effort
How much a reasoning model should think before it answers. One of none, minimal, low, medium, high, xhigh or max; also accepted as reasoning.effort. Each reasoning model maps the value onto its own thinking tiers, and models without a thinking mode ignore it. reasoning_effort has no effect on reka-flash-3 or reka-edge-2603.
Lower it for latency-sensitive or simple requests. Raise it for math, multi-step planning, and other problems where the model benefits from working through the answer first. The thinking trace comes back in message.reasoning_content, and usage.reasoning_tokens reports what it cost.
Typical default: model-specific. Any other value is a 400 with code invalid_value. See Reasoning for details.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.reka.ai/v1",
api_key=os.environ["REKA_API_KEY"],
)
response = client.chat.completions.create(
model="deepseek4-flash",
messages=[{"role": "user", "content": "Summarize the plot of Hamlet in one sentence."}],
reasoning_effort="low",
)
print(response.choices[0].message.content)Not every reasoning model thinks on a plain request. See Reasoning for which models think by default and which have adjustable reasoning effort.
Capability-specific parameters
These parameters belong to features with their own dedicated pages. Each link below covers the full schema, supported models, and end-to-end examples.
response_format: constrain the output to JSON or a JSON Schema so you can parse it directly. See Structured outputs.tools: let the model call functions you define. See Tool calling.logprobs: return per-token log probabilities for confidence scoring and token-level analysis. See Logprobs.stream: receive the response as server-sent events as the model generates them. See Stream responses.