On this page

Text Generation

Base path: /v1

POST /chat/completions

Handles chat completions. This endpoint takes a list of messages and returns a generated response.

1curl -X POST https://api.arliai.com/v1/chat/completions \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5  "model": "MODEL_NAME",
6  "messages": [
7    {"role": "system", "content": "You are a helpful assistant."},
8    {"role": "user", "content": "Hello!"}
9  ]
10}'

POST /chat/completions (with Image)

This endpoint allows you to send a text prompt along with an image for Vision Language Models (VLM). The user message content should be an array containing both the text and the image URL (base64 encoded).

1curl -X POST https://api.arliai.com/v1/chat/completions \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5 "model": "VLM_MODEL_NAME",
6 "messages": [
7   {
8     "role": "user",
9     "content": [
10       {"type": "text", "text": "What is in this image?"},
11       {
12         "type": "image_url",
13         "image_url": {
14           "url": "data:image/jpeg;base64,your_base64_encoded_image"
15         }
16       }
17     ]
18   }
19 ]
20}'

POST /completions

Handles text completions. This endpoint takes a prompt and returns a generated response.

1curl -X POST https://api.arliai.com/v1/completions \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5  "model": "MODEL_NAME",
6  "prompt": "Once upon a time",
7  "max_completion_tokens": 50
8}'
ParameterTypeRequiredDescription
Core Input
modelstringrequiredThe model name to use for this request. Required unless `multi_models` is provided. If both are provided, `multi_models` takes precedence. Use GET /v1/models to list the models available to your API key.
multi_modelslist[string]optionalRandomly select one model from this list for each request. Alternative to `model`; when both are provided, `multi_models` takes precedence. Every model in the list must be available to your API key.
messageslist[ChatCompletionMessageParam]required (chat)(chat only) The conversation as a list of message objects (role, content, plus optional tool_calls, name, etc.). Required for chat completions. Each message is rendered into the model's prompt via the chat template.
promptstring | list[int] | nullrequired (text)(text only) A single input text or a single pre-tokenized token ID list. Batched prompts (a list of strings or a list of token ID lists) are not allowed. Required for text completions.
userstring | nulloptionalOpenAI-style end-user identifier. Ignored by vLLM — included only for API compatibility. No effect on generation or logging.
Sampling & Decoding
temperaturefloat | nulloptionalControls randomness in sampling. Lower values (e.g. 0.2) make output more deterministic/focused; higher values (e.g. 1.5) increase diversity. 0.0 forces greedy decoding (picks the highest-probability token each step). Must be ≥ 0. Default: 1.0*.
top_pfloat | nulloptionalNucleus sampling. Only consider the smallest set of tokens whose cumulative probability reaches top_p. 1.0 = consider all tokens (disabled). 0.1 = only the top 10% probability mass. Must be in (0, 1]. Default: 1.0*.
top_kint | nulloptionalOnly sample from the top k highest-probability tokens at each step. 0 or -1 = disabled (consider all). Lower values = more focused. OpenAI has no equivalent. Default: 0*.
min_pfloat | nulloptionalMin-p sampling. Keeps only tokens whose probability is at least min_p × max_token_probability. Scales relative to the top token, so it adapts to confidence. 0.0 = disabled. Typical values 0.05–0.1. Default: 0.0*.
nintoptionalNumber of independent completions to generate for the prompt. Each counts against the engine's concurrency budget. Higher n = more GPU work. Default: 1.
seedint | nulloptionalRNG seed for reproducible sampling. Same seed + same prompt + same params → same output (assuming deterministic execution). null = nondeterministic. Int64 range. Default: null.
presence_penaltyfloat | nulloptionalOpenAI-style penalty: tokens that have appeared at least once get their logits reduced. Positive values encourage new topics. Range typically [-2.0, 2.0]. Default: 0.0.
frequency_penaltyfloat | nulloptionalOpenAI-style penalty: penalty scales with how often a token has appeared. Positive values reduce repetition of frequent tokens. Range typically [-2.0, 2.0]. Default: 0.0.
repetition_penaltyfloat | nulloptionalHuggingFace-style multiplicative penalty: divides the logit of any already-seen token by this value. 1.0 = no penalty; >1.0 discourages repetition. Distinct from the OpenAI additive penalties above. Default: 1.0*.
length_penaltyfloatoptionalUsed with use_beam_search. Exponentially scales beam scores by sequence length. >1.0 favors longer sequences; <1.0 favors shorter. 1.0 = neutral. Default: 1.0.
min_tokensintoptionalForce the model to generate at least this many tokens before any stop string or stop_token_ids can terminate generation. EOS is still respected unless ignore_eos is set. Useful to prevent premature stopping in structured outputs. Default: 0.
stopstring | list[string] | nulloptionalStop strings — generation halts when any of these substrings appears in the output. The stop string itself is excluded from output unless include_stop_str_in_output is true. Default: [].
stop_token_idslist[int] | nulloptionalStop at these specific token IDs (more efficient than string matching). Merged with any server-configured default stop IDs (deduplicated, request values first). Default: [].
include_stop_str_in_outputbooloptionalWhen true, the matching stop string/stop token is included in the returned text instead of being stripped. Default: false.
ignore_eosbooloptionalWhen true, the EOS (end-of-sequence) token does not terminate generation — the model keeps going until max_tokens or a stop condition. Useful for forcing a fixed output length. Default: false.
use_beam_searchbooloptionalSwitch from random sampling to beam search. n becomes the beam width. Mutually exclusive with most samplers (top_p, top_k, min_p are ignored). Uses length_penalty for scoring. Default: false.
bad_wordslist[string]optionalDisallows these substrings from appearing in the output (enforced via token-level bans). Stronger than a soft penalty — the words cannot appear at all. Default: [].
allowed_token_idslist[int] | nulloptionalRestrict generation to only these token IDs at every step (allowlist). null = no restriction. Useful for constrained vocabularies (e.g., classification over a fixed label set). Default: null.
logit_biasdict[string, float] | nulloptionalMap of token ID (as string) → bias added to that token's logit. Positive bias increases the chance of that token; negative decreases. Range typically [-100, 100]. Default: null.
Length & Truncation
max_tokensint | nulloptionalMaximum number of tokens to generate. Deprecated for chat in favor of max_completion_tokens. Bounded server-side by max_model_len - prompt_length. Default: null (chat) / 16 (text).
max_completion_tokensint | nulloptional(chat only) OpenAI's current name for the max output length. Preferred over max_tokens for chat. Takes precedence when both are set. Default: null.
truncate_prompt_tokensint | nulloptionalTruncate the prompt to this many tokens before generation. -1 = keep all tokens (no truncation, but enables offset tracking). A positive value keeps only that many tokens (respecting truncation_side). Must be ≥ -1. Default: null.
truncation_side"left" | "right" | nulloptionalControls which end of the prompt is kept when truncate_prompt_tokens is active. "right" keeps the first N tokens (drops the tail); "left" keeps the last N tokens (drops the head). null = use tokenizer default. Default: null.
echobooloptionalText completion: echoes the prompt back as part of the output (prepended to generated text). Chat: prepends the last user message to the generated response if same role. Also enables prompt_logprobs implicitly if top_logprobs is set. Default: false.
Logprobs
logprobsbool | null (chat) / int | null (text)optionalChat: boolean — whether to return logprobs at all. Pair with top_logprobs for the count. Text: integer 0–20 — number of top logprobs to return per generated token. null = disabled. Default: false (chat) / null (text).
top_logprobsint | nulloptional(chat only) Number of top alternative tokens (with logprobs) to return at each generated position. Requires logprobs: true. 0 = none. Max typically 20. Default: 0.
prompt_logprobsint | nulloptionalReturn logprobs for each prompt token (not just generated tokens). Integer = number of top logprobs per prompt token; -1 = all. In text completion, not allowed with stream=true (except 0). Must be ≥ 0 or exactly -1. Default: null.
logprob_token_idslist[int] | nulloptionalReturn logprobs for these specific token IDs at each generated position (in addition to the sampled token). More efficient than top_logprobs=-1 when you only need a fixed label set. Requires logprobs to be enabled. Not supported with beam search or with echo=true + max_tokens=0. Default: null.
Tokenization & Detokenization
skip_special_tokensbooloptionalWhen detokenizing output back to text, strip special tokens (e.g., <|im_start|>, <eos>). false keeps them visible — useful for debugging token streams. Default: true.
spaces_between_special_tokensbooloptionalInsert spaces between special tokens during detokenization for readability. false = no extra spacing. Default: true.
add_special_tokensbooloptionalAdd model-specific special tokens (e.g., BOS) to the prompt on top of what the chat template produces. For chat, the template usually handles this, so default is false. For raw text completion, default is true. Default: false (chat) / true (text).
Streaming
streambool | nulloptionalReturn tokens incrementally via Server-Sent Events (SSE) as they're generated, rather than waiting for the full completion. Default: false.
stream_optionsStreamOptions | nulloptionalSub-object for streaming controls. Requires stream: true. Fields: include_usage (bool, default false) — emit a final chunk with token usage stats; continuous_usage_stats (bool, default false) — include running usage stats in every chunk. Default: null.
Structured Outputs
response_formatAnyResponseFormat | nulloptionalConstrains the output format. Accepted values: {"type": "text"} — no constraint; {"type": "json_object"} — output is valid JSON; {"type": "json_schema", "json_schema": {"schema": {...}}} — output conforms to a specific JSON Schema; {"type": "structural_tag", ...} — vLLM-specific; constrains content within structural tags. Internally maps to structured_outputs fields. On chat, json_schema requires a schema (or json_schema) sub-object. Default: null.
structured_outputsStructuredOutputsParams | nulloptionalDirect, lower-level structured-output configuration. Exactly one constraint field may be set: json (str|dict) — a JSON Schema; regex (str) — a regex the output must match; choice (list[str]) — output must be one of these exact strings; grammar (str) — a context-free grammar (Lark-style); json_object (bool) — output is any valid JSON object; structural_tag (str) — JSON-serialized structural-tag spec. Plus options: disable_any_whitespace, disable_additional_properties, whitespace_pattern. Setting more than one constraint raises a validation error. Default: null.
Reasoning / Thinking
reasoning_effort"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | nulloptional(chat only) Controls how much reasoning/thinking effort reasoning models (e.g., o1-style, DeepSeek-R1) spend. Lower values = faster, fewer thinking tokens. none disables thinking. max is DeepSeek V4-specific and not part of the OpenAI spec. Also propagates enable_thinking into chat template kwargs for templates that require explicit opt-in. Default: null.
thinking_token_budgetint | nulloptionalHard cap on the number of tokens the model may spend on internal "thinking" (reasoning) before producing the final answer. ≥0 = limit; -1 = unlimited (treated as unset). For reasoning models that expose a separate thinking channel. Default: null.
include_reasoningbooloptional(chat only) Whether to include the model's reasoning/thinking trace in the response (in the reasoning field of the assistant message). false returns only the final answer. Default: true.
repetition_detectionRepetitionDetectionParams | nulloptionalEarly-terminates generation when repetitive N-gram patterns are detected (e.g., abcdabcdabcd...). Sub-fields: max_pattern_size (int, default 0) — largest N-gram to check, 0 = disabled; min_pattern_size (int, default 0) — smallest N-gram to check, 0 → defaults to 1, must be ≤ max_pattern_size; min_count (int, default 0) — how many times a pattern must repeat to trigger, must be ≥ 2 when max_pattern_size > 0. Default: null.
Tools (Chat Only)
toolslist[ChatCompletionToolsParam] | nulloptional(chat only) List of tool/function definitions the model may call. Each tool has a type ("function") and a function (FunctionDefinition: name, description, parameters JSON Schema, optional strict, defer_loading). The model returns tool_calls in its response rather than (or alongside) text. Default: null.
tool_choice"none" | "auto" | "required" | ChatCompletionNamedToolChoiceParam | nulloptional(chat only) Controls tool use: "none" — never call tools; "auto" — model decides whether to call a tool; "required" — model must call at least one tool; {"type": "function", "function": {"name": "..."}} — force a specific function. Default: "none".
parallel_tool_callsbool | nulloptional(chat only) Whether the model may emit multiple tool calls in a single response. Default: true.
Chat Template (Chat Only)
add_generation_promptbooloptional(chat only) Append the assistant turn header to the rendered prompt so the model begins generating. false = render only the conversation context without prompting a response (useful for inspection). Cannot be combined with continue_final_message. Default: true.
continue_final_messagebooloptional(chat only) Format the chat so the final message is left open-ended (no EOS), letting the model continue the last assistant message rather than starting a new one. Enables response prefilling. Mutually exclusive with add_generation_prompt. Default: false.
chat_template_kwargsdict[string, Any] | nulloptional(chat only) Extra variables passed into the Jinja template renderer. Allowed keys: enable_thinking (bool); thinking (bool); thinking_mode ("enabled" | "disabled" | "auto"); thinking_effort ("low" | "medium" | "high"); reasoning_effort ("none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"); tools (array, same schema as the top-level tools field); date_string (string); current_date (string); bos_token (string); eos_token (string); system_prompt (string; length is limited by the model context). Unknown keys are dropped. Default: null.
Response Controls
return_tokens_as_token_idsbool | nulloptionalWhen returning logprobs, represent tokens as strings of the form token_id:{id} instead of decoded text. Lets you identify tokens that aren't JSON-encodable (e.g., control characters). Default: null.
return_token_idsbool | nulloptionalInclude token IDs alongside generated text in the response. In streaming mode, prompt_token_ids appears only in the first chunk; token_ids contains delta tokens per chunk. Default: null.
return_prompt_textbool | nulloptional(chat only) Include prompt_text in the response — the exact prompt string produced by chat templating. In streaming, sent only on the first chunk. Useful for debugging what the model actually received. Default: null.

POST /tokenize

Tokenizes the given text.

ParameterTypeRequiredDescription
modelstringoptionalThe model to use for tokenization.
multi_modelsarray of stringsoptionalA list of models to choose from.
promptstringoptionalThe prompt to tokenize.
messagesarrayoptionalThe messages to tokenize.
1curl -X POST https://api.arliai.com/v1/tokenize \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5  "model": "MODEL_NAME",
6  "prompt": "Hello, world!"
7}'