이 페이지
텍스트 생성
기본 경로: /v1
POST /chat/completions
채팅 완성을 처리합니다. 이 엔드포인트는 메시지 목록을 받아 생성된 응답을 반환합니다.
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 (이미지 포함)
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
텍스트 완성을 처리합니다. 이 엔드포인트는 프롬프트를 받아 생성된 응답을 반환합니다.
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}'| 매개변수 | 유형 | 필수 | 설명 |
|---|---|---|---|
| Core Input | |||
| model | string | required | The 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_models | list[string] | optional | Randomly 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. |
| messages | list[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. |
| prompt | string | list[int] | null | required (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. |
| user | string | null | optional | OpenAI-style end-user identifier. Ignored by vLLM — included only for API compatibility. No effect on generation or logging. |
| Sampling & Decoding | |||
| temperature | float | null | optional | Controls 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_p | float | null | optional | Nucleus 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_k | int | null | optional | Only 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_p | float | null | optional | Min-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*. |
| n | int | optional | Number of independent completions to generate for the prompt. Each counts against the engine's concurrency budget. Higher n = more GPU work. Default: 1. |
| seed | int | null | optional | RNG seed for reproducible sampling. Same seed + same prompt + same params → same output (assuming deterministic execution). null = nondeterministic. Int64 range. Default: null. |
| presence_penalty | float | null | optional | OpenAI-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_penalty | float | null | optional | OpenAI-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_penalty | float | null | optional | HuggingFace-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_penalty | float | optional | Used 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_tokens | int | optional | Force 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. |
| stop | string | list[string] | null | optional | Stop 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_ids | list[int] | null | optional | Stop 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_output | bool | optional | When true, the matching stop string/stop token is included in the returned text instead of being stripped. Default: false. |
| ignore_eos | bool | optional | When 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_search | bool | optional | Switch 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_words | list[string] | optional | Disallows 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_ids | list[int] | null | optional | Restrict 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_bias | dict[string, float] | null | optional | Map 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_tokens | int | null | optional | Maximum 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_tokens | int | null | optional | (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_tokens | int | null | optional | Truncate 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" | null | optional | Controls 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. |
| echo | bool | optional | Text 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 | |||
| logprobs | bool | null (chat) / int | null (text) | optional | Chat: 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_logprobs | int | null | optional | (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_logprobs | int | null | optional | Return 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_ids | list[int] | null | optional | Return 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_tokens | bool | optional | When 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_tokens | bool | optional | Insert spaces between special tokens during detokenization for readability. false = no extra spacing. Default: true. |
| add_special_tokens | bool | optional | Add 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 | |||
| stream | bool | null | optional | Return tokens incrementally via Server-Sent Events (SSE) as they're generated, rather than waiting for the full completion. Default: false. |
| stream_options | StreamOptions | null | optional | Sub-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_format | AnyResponseFormat | null | optional | Constrains 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_outputs | StructuredOutputsParams | null | optional | Direct, 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" | null | optional | (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_budget | int | null | optional | Hard 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_reasoning | bool | optional | (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_detection | RepetitionDetectionParams | null | optional | Early-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) | |||
| tools | list[ChatCompletionToolsParam] | null | optional | (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 | null | optional | (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_calls | bool | null | optional | (chat only) Whether the model may emit multiple tool calls in a single response. Default: true. |
| Chat Template (Chat Only) | |||
| add_generation_prompt | bool | optional | (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_message | bool | optional | (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_kwargs | dict[string, Any] | null | optional | (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_ids | bool | null | optional | When 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_ids | bool | null | optional | Include 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_text | bool | null | optional | (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
주어진 텍스트를 토큰화합니다.
| 매개변수 | 유형 | 필수 | 설명 |
|---|---|---|---|
| model | string | optional | The model to use for tokenization. |
| multi_models | array of strings | optional | A list of models to choose from. |
| prompt | string | optional | The prompt to tokenize. |
| messages | array | optional | The 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}'