Skip to main content
Wafer’s self-hosted SGLang routes support pre-tokenized prompts on the OpenAI-compatible /v1/completions endpoint. You can also constrain decoding with SGLang/XGrammar-compatible EBNF by passing ebnf.

Model Support

/v1/completions is only available on Wafer’s self-hosted sglang routes. Models proxied to an upstream that does not expose a text-completion endpoint will return 404 for /v1/completions — use /v1/chat/completions against them instead. The same applies to ebnf / regex / json_schema constrained decoding — these require an sglang backend, so they only work on the “Yes” rows above. response_format: {"type": "json_object"} on /v1/chat/completions is broadly supported and is the right choice for structured output on the rest of the catalog.

Curl Request

Set stream to true and add -N to stream text completion chunks as server-sent events:

Request Body

Advanced SGLang passthrough fields are also accepted when you need lower-level control: custom_params, ignore_eos, no_stop_trim, spaces_between_special_tokens, stop_regex, structural_tag, custom_logit_processor, logprob_start_len, lora_path, priority, return_hidden_states, return_logprob, return_routed_experts, return_text_in_logprobs, rid, token_ids_logprob, and top_logprobs_num.
prompt must be token IDs on this endpoint. A non-empty array like [9703] is valid; ["hello"], an empty array, booleans, negative integers, and mixed token/string arrays are rejected.

Response Shape

Non-streaming responses use the OpenAI text completion shape:
For ordinary chat-style messages, use POST https://pass.wafer.ai/v1/chat/completions instead.