Qwen3.8-27B-NVFP4
Description
"Qwen3.8-27B-NVFP4" is a dense language model by Alibaba with 27 billion parameters and a built-in vision encoder. In the Mixture-of-Experts models in this list only part of the network computes each token, while here every parameter takes part in every forward pass. That costs more compute time, but it holds up better on multi-step work such as tool loops and long-running agents. Compared with Qwen3.6 the model is stronger at coding, professional tasks, and long-horizon agentic workflows.
It supports and is suitable for:
- Text generation within a chat completion (text to text)
- Tool-calling for agentic workflows
- Image understanding (vision)
- Thinking / reasoning for step-by-step problem solving, with three selectable reasoning depths
- Processing long documents and extended contexts
The following limitations apply:
- Maximum context length: 256,000 tokens
- At most 5 images per request
- Images must be submitted as Base64-encoded data URLs (no remote URLs)
- Video input is not offered on this endpoint, even though the model itself can process video
Thinking mode is enabled by default, at the model's highest reasoning depth. See
Controlling reasoning depth for the cheaper levels, What the default costs for what that is worth in tokens, and
Disabling thinking mode for turning it off — the parameters must be nested
inside chat_template_kwargs.
Using this model from n8n? The built-in OpenAI Chat Model node can't set chat_template_kwargs — see Reasoning models and thinking mode for a community-node workaround.
Controlling reasoning depth
This model accepts three reasoning depths. Lowering the depth reduces latency and token cost per turn:
| Level | Use for |
|---|---|
xhigh (default) | Complex tasks that need thorough analysis |
medium | Balance between accuracy and speed |
low | Speed and cost, at the price of shallower analysis |
Those three spellings are the only ones the model accepts, and they are case-sensitive: Low
is rejected the same way as an unknown level. If you are porting code from OpenAI, note that
minimal does not exist here — use low. An unsupported value comes back as a 400 that names
the value you sent and lists the accepted ones.
- Python
- JavaScript
- PHP
from openai import OpenAI
client = OpenAI(
base_url="https://llm.aihosting.mittwald.de/v1",
api_key="sk-your-api-key-here",
)
response = client.chat.completions.create(
model="Qwen3.8-27B-NVFP4",
messages=[{"role": "user", "content": "Summarise this changelog entry in one sentence."}],
temperature=1.0,
top_p=0.95,
max_tokens=32768,
extra_body={
"chat_template_kwargs": {"reasoning_effort": "low"},
},
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://llm.aihosting.mittwald.de/v1",
apiKey: "sk-your-api-key-here",
});
const response = await client.chat.completions.create({
model: "Qwen3.8-27B-NVFP4",
messages: [
{
role: "user",
content: "Summarise this changelog entry in one sentence.",
},
],
temperature: 1.0,
top_p: 0.95,
max_tokens: 32768,
// @ts-ignore – vLLM extension
chat_template_kwargs: { reasoning_effort: "low" },
} as any);
console.log(response.choices[0].message.content);
<?php
// composer require openai-php/client guzzlehttp/guzzle
$client = OpenAI::factory()
->withBaseUri('https://llm.aihosting.mittwald.de/v1')
->withApiKey('sk-your-api-key-here')
->make();
$response = $client->chat()->create([
'model' => 'Qwen3.8-27B-NVFP4',
'messages' => [
['role' => 'user', 'content' => 'Summarise this changelog entry in one sentence.'],
],
'temperature' => 1.0,
'top_p' => 0.95,
'max_tokens' => 32768,
'chat_template_kwargs' => ['reasoning_effort' => 'low'],
]);
echo $response->choices[0]->message->content;
What the default costs, and when to turn it down
The default depth is the expensive one, and the reasoning tokens count against your monthly token quota exactly like the answer does. The AI Hosting plans start at 5 million tokens per month, so on a small plan the reasoning is the part that runs the quota down.
Measured on two everyday tasks, five runs each, median reasoning tokens per answer with the range across runs:
| Task | xhigh (default) | medium | low | thinking off |
|---|---|---|---|---|
| Classify one sentence | 308 (144–1,484) | 372 (292–466) | 286 (152–406) | 0 |
| Four-sentence support answer | 235 (176–329) | 236 (139–449) | 252 (148–300) | 0 |
| Total tokens per answer, median | 332 | 368 | 354 | 54 |
Two things follow from that, and the second one is the one that saves money:
- On easy tasks the three depths cost about the same. Between 235 and 372 reasoning tokens
either way. Turning
xhighdown tolowis not where the saving is. - Turning thinking off is where the saving is. For the classification the median answer went from 312 tokens to 2, for the short support answer from 351 to 122.
So the recommendation, by task:
| Task | Setting |
|---|---|
| Classification, routing, extraction, short standard answers | "enable_thinking": false |
| Everyday chat, drafting, translation, summaries | "reasoning_effort": "low" |
| Code with several steps, tool loops, planning | "reasoning_effort": "medium" |
| Hard analysis, tricky debugging, long agent runs | leave it at xhigh |
One more reason not to leave xhigh on for everything: it is the least predictable setting. On the
classification task its reasoning ran between 144 and 1,484 tokens for the same prompt, which is a
factor of ten in cost between two identical requests. At 250 reasoning tokens per answer, 5 million
tokens are gone after roughly 20,000 answers, with nothing of that spent on text a user sees.
mStudio notifies you at 75% of your quota and again by email at 90%.
In multi-turn agent tasks a lower reasoning depth does not automatically finish the whole task faster. Individual turns come back quicker, but shallower analysis leads to more failed steps and retries, which can raise total latency and total token use. Measure the whole task, not one turn.
On /v1/responses the same control is available as the endpoint's native reasoning.effort
field, without chat_template_kwargs.
Disabling thinking mode
- Python
- JavaScript
- PHP
from openai import OpenAI
client = OpenAI(
base_url="https://llm.aihosting.mittwald.de/v1",
api_key="sk-your-api-key-here",
)
response = client.chat.completions.create(
model="Qwen3.8-27B-NVFP4",
messages=[{"role": "user", "content": "What is 2 + 2?"}],
temperature=0.7,
top_p=0.8,
presence_penalty=1.5,
max_tokens=32768,
extra_body={
"chat_template_kwargs": {"enable_thinking": False},
# ^^^^^^^^^^^^^^^^^^^^^^^^
# Must be nested here — passing enable_thinking at the top level
# is silently ignored by the API.
},
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://llm.aihosting.mittwald.de/v1",
apiKey: "sk-your-api-key-here",
});
const response = await client.chat.completions.create({
model: "Qwen3.8-27B-NVFP4",
messages: [{ role: "user", content: "What is 2 + 2?" }],
temperature: 0.7,
top_p: 0.8,
presence_penalty: 1.5,
max_tokens: 32768,
// @ts-ignore – vLLM extension; must be nested here, not enable_thinking at top level
chat_template_kwargs: { enable_thinking: false },
} as any);
console.log(response.choices[0].message.content);
<?php
// composer require openai-php/client guzzlehttp/guzzle
$client = OpenAI::factory()
->withBaseUri('https://llm.aihosting.mittwald.de/v1')
->withApiKey('sk-your-api-key-here')
->make();
$response = $client->chat()->create([
'model' => 'Qwen3.8-27B-NVFP4',
'messages' => [
['role' => 'user', 'content' => 'What is 2 + 2?'],
],
'temperature' => 0.7,
'top_p' => 0.8,
'presence_penalty' => 1.5,
'max_tokens' => 32768,
'chat_template_kwargs' => ['enable_thinking' => false],
// Must be nested here — passing 'enable_thinking' => false at the top
// level of the request is silently ignored by the API.
]);
echo $response->choices[0]->message->content;
Reasoning across turns
By default this model keeps the reasoning blocks of all previous messages in the conversation, not just the latest one. That keeps decisions consistent across an agent run and improves prefix-cache reuse, which lowers latency on follow-up turns. It also means the reasoning of earlier turns counts towards your context window.
To keep only the reasoning of the most recent user message, send:
extra_body={"chat_template_kwargs": {"preserve_thinking": False}}
Reading the response
When thinking mode is enabled (default), the model returns two separate fields:
| Field | Contents |
|---|---|
choices[0].message.reasoning | Internal chain-of-thought (may be very long) |
choices[0].message.content | Final answer |
If content is empty, check finish_reason: length means the token budget ran out during
reasoning (see the warning above), while stop means the model placed its answer inside the
reasoning block — in that case disable thinking mode to ensure content is always populated.
print(response.choices[0].message.reasoning) # internal chain-of-thought
print(response.choices[0].message.content) # final answer
Recommended inference parameters
The model has different recommended settings depending on the use case. Do not use greedy decoding (temperature 0) - it can cause performance degradation and repetitions.
Thinking mode (default)
| Parameter | Value |
|---|---|
temperature | 1.0 |
top_p | 0.95 |
top_k | 20 |
presence_penalty | 0.0 |
Non-thinking mode (enable_thinking: false)
| Parameter | Value |
|---|---|
temperature | 0.7 |
top_p | 0.8 |
top_k | 20 |
presence_penalty | 1.5 |
If you see endless repetition, raise presence_penalty in steps up to 2.0. Higher values can
occasionally mix languages and cost a little quality, so raise it only as far as needed.
Output length
Set max_tokens according to task complexity to control cost and latency. Because reasoning tokens
come out of the same budget, be more generous here than you would be with a non-reasoning model:
| Task type | Recommended max_tokens |
|---|---|
| Standard queries | 32,768 |
| Complex problems (math, programming contests) | 81,920 |
Long agent runs with reasoning_effort: xhigh | 131,072 |
Tips for specific tasks
Vision (image to text)
Always disable thinking mode for vision tasks - thinking adds latency without improving image understanding:
extra_body={"chat_template_kwargs": {"enable_thinking": False}}
Recommended parameters for vision:
| Parameter | Value |
|---|---|
temperature | 0.7 |
top_p | 0.8 |
top_k | 20 |
max_tokens | 512–2048 depending on task |
For accurate text extraction (OCR) or data reading, use temperature=0.1 instead. For whole
documents, GLM-OCR is the better fit.
Always resize images to a maximum of 1024 px on the longest edge before encoding as Base64 - large images significantly increase time to first token (TTFT). The first request for a new image will have a longer TTFT while the image encoder warms up; subsequent requests with the same image benefit from caching. See the Python examples or JavaScript examples for a ready-to-use helper.
At most 5 images fit into one request. Split larger batches across requests.
Math problems
For best results on mathematical tasks, append the following instruction to your prompt:
Please reason step by step, and put your final answer within \boxed{}.
Multiple-choice questions
To get consistent, parseable output on multiple-choice tasks, add this to your prompt:
Please show your choice in the 'answer' field with only the choice letter, e.g., 'answer': 'C'.
Switching from Qwen3.6-35B-A3B-FP8
Both models are Apache 2.0, cost the same per token and accept the same 256,000-token context, so
a switch is mostly a change of the model string. Four things do behave differently:
| Qwen3.6-35B-A3B-FP8 | Qwen3.8-27B-NVFP4 | |
|---|---|---|
| Thinking | on or off | on or off, plus three depths through reasoning_effort |
| Default reasoning depth | one fixed depth | xhigh, the deepest one, so expect more reasoning tokens per answer |
presence_penalty in thinking mode | 1.5 | 0.0 |
| Reasoning of earlier turns | dropped | kept, see Reasoning across turns |
What to do when you move a working integration across:
- Change
modeltoQwen3.8-27B-NVFP4. - Drop
presence_penaltyto 0.0 for thinking-mode requests, or leave it out and take the default. - Raise
max_tokens, or setreasoning_efforttomediumorlow. The deeper default is where most migrations first notice a difference, either as higher token bills or as empty answers. - If your integration sends long conversations, check your context use. Kept reasoning blocks
count towards the window;
preserve_thinking: falserestores the old behaviour.
Nothing else changes: the same chat_template_kwargs nesting, the same Base64 data URLs for
images, the same tool-calling format.
Terms of use and licensing
The general terms of use apply. The model is provided by Alibaba under the Apache 2.0 License, and reuse of the generated content is not subject to any additional restrictions.