OpenToken Docs

Sampling parameters

OpenToken accepts the OpenRouter sampling superset and forwards only what each upstream supports.

OpenToken accepts the OpenRouter sampling superset on POST /v1/chat/completions. Each provider adapter forwards only the parameters its upstream actually supports and silently drops the rest, so you can send the same request body across models without it being rejected for an unsupported field.

Common parameters

Prop

Type

Example

from openai import OpenAI

client = OpenAI(
    base_url="https://api.opentoken.kr/v1",
    api_key=os.environ["OPENTOKEN_API_KEY"],
)

resp = client.chat.completions.create(
    model="google/gemini-2.5-pro",
    messages=[{"role": "user", "content": "Name three primary colors."}],
    temperature=0.7,
    top_p=0.9,
    max_tokens=128,
    seed=42,
)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.opentoken.kr/v1",
  apiKey: process.env.OPENTOKEN_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "google/gemini-2.5-pro",
  messages: [{ role: "user", content: "Name three primary colors." }],
  temperature: 0.7,
  top_p: 0.9,
  max_tokens: 128,
  seed: 42,
});
curl https://api.opentoken.kr/v1/chat/completions \
  -H "Authorization: Bearer $OPENTOKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-pro",
    "messages": [{"role": "user", "content": "Name three primary colors."}],
    "temperature": 0.7,
    "top_p": 0.9,
    "max_tokens": 128,
    "seed": 42
  }'

Gemini specifics

Support varies by model generation, and the adapter handles the difference for you:

  • Gemini 2.5 (google/gemini-2.5-pro) accepts frequency_penalty, presence_penalty, and seed.
  • Gemini 3 (google/gemini-3-flash, google/gemini-3.1-pro, google/gemini-3.1-flash-lite) rejects penalties and seed, so those fields are dropped before the request reaches the upstream.

Dropped parameters do not produce an error. A request with seed on a Gemini 3 model succeeds normally; the field is simply ignored.

Anthropic specifics

Claude models accept temperature, top_p, top_k, max_tokens, and stop. The penalty and determinism fields are not supported by Anthropic and are silently dropped on every Claude model:

  • frequency_penalty, presence_penalty, seed, and logit_bias are never forwarded to Anthropic.
  • claude-opus-4-7 ignores temperature, top_p, and top_k — Anthropic rejects them on this model, so the adapter omits all three.
  • Other Claude 4.x models accept only one of temperature or top_p (Anthropic returns a 400 if both are sent, so the adapter forwards temperature and drops top_p when both are present), plus top_k.
  • When extended thinking is enabled, temperature, top_p, and top_k are dropped on every Claude model regardless of the above.

See Models for the full list of registered Claude models and their capabilities.

OpenRouter-only fields

The schema accepts several OpenRouter superset fields for compatibility — top_a, min_p, repetition_penalty, logit_bias, logprobs, and top_logprobs — but none of them map to an upstream parameter on the currently available Gemini and Claude models, so they are accepted and then dropped.