v8

latestOpenAPI 3.0.3raw.githubusercontent.com2026-08-0142317.7 KB

Creates a model response for the given chat conversation

This endpoint generates a model response for a given conversation, which can include text and images. It supports both single-turn and multi-turn conversations and can be used for various tasks like question answering, code generation, and function calling.

post/v1/chat/completions

Request body

modelstring required

ID of the model to use

nctxinteger

Context window size (llama_cpp only). Omit to use the server default set via geniex serve --nctx / GENIEX_NCTX (4096 out of the box).

max_completion_tokensinteger

An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.

temperaturenumber float

What sampling temperature to use, between 0 and 2

top_pnumber float

An alternative to sampling with temperature, called nucleus sampling

streamboolean

If set, partial message deltas will be sent

presence_penaltynumber float

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far

frequency_penaltynumber float

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far

enable_jsonboolean

Whether to enable JSON response generation

enable_thinkboolean

Whether to enable thinking mode for the model

top_kinteger

An alternative to sampling with temperature, called top-k sampling

min_pnumber float

An alternative to sampling with temperature, called nucleus sampling

repetition_penaltynumber float

The parameter for repetition penalty. 1.0 means no penalty

grammar_pathstring

Path to the grammar file for structured output

grammar_stringstring

Grammar string for structured output

nglinteger

Number of GPU/NPU layers to offload (llama_cpp only). Omit to use the server default set via geniex serve --ngl / GENIEX_NGL (999 out of the box); the server chooses the correct layout per backend.

compute'cpu' | 'gpu' | 'npu' | 'hybrid'

Compute unit to run on. Omit to use the server default set via geniex serve --compute / GENIEX_COMPUTE. QAIRT is NPU-only; other aliases are coerced with a warning.

image_max_lengthinteger

Maximum length for image processing (VLM only)

spec_type'draft-mtp' | 'draft-eagle3' | 'draft-simple' | 'ngram-simple' | 'ngram-map-k' | 'ngram-map-k4v' | 'ngram-mod' | 'ngram-cache'

Speculative decoding type (llama_cpp only). Omit or set to empty to disable. draft-* variants require spec_draft_model; ngram-* variants are self-speculative.

spec_draft_modelstring

Draft/MTP model for draft-* spec types (llama_cpp only). Catalogue name org/repo[:precision] (must be pulled via geniex pull beforehand — the server does NOT auto-download) or absolute path to a local GGUF file.

spec_n_maxinteger

Max draft tokens per verification step (llama_cpp only). Default 3 when omitted.

spec_n_mininteger

Min draft tokens per verification step (llama_cpp only). 0 = llama.cpp default.

spec_p_minnumber float

Min greedy draft probability (llama_cpp only). 0 = llama.cpp default.

Example request

{
  "model": "qualcomm/Qwen3-4B-Instruct-2507",
  "messages": [
    {
      "role": "user",
      "content": "Hello! Briefly introduce yourself."
    }
  ],
  "nctx": 0,
  "max_completion_tokens": 2048,
  "temperature": 0.8,
  "top_p": 0.95,
  "stream": false,
  "enable_json": false,
  "enable_think": true
}

Response

Successful response for non-streaming requests

idstring

A unique identifier for the chat completion

objectstring

The object type, which is always "chat.completion"

createdinteger

The Unix timestamp (in seconds) of when the chat completion was created

modelstring

The model used for the chat completion

All 4 operations