> This page is for Model APIs.

> Sarvam Voice Agents (Samvaad) is a voice AI agent platform for Indian languages: build, test and deploy AI calling agents on your own phone numbers, from ₹3 a minute. Start here: https://docs.sarvam.ai/voice-agents/why-voice-agents.
> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt. For a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt).
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Qwen 3.8 27B

> Qwen 3.8 27B is a 27B-parameter open-weight reasoning model for text and image understanding, with a 262,144-token context window and tool calling. Available on Provisioned Throughput.

Qwen 3.8 27B is a 27B-parameter open-weight reasoning model served on Sarvam
infrastructure. It accepts **text and images** and has a **262,144-token context
window**. It thinks before answering by default, and you can turn thinking off for
direct answers (see [Reasoning](#reasoning)).

> **Note**
>
> Qwen 3.8 27B is available on **Provisioned Throughput**: capacity is set up for your workload and enabled for your organisation. Without access, requests return `404 not_found_error` and the model isn't listed in [`GET /v2/models`](/api-reference/chat/models-v2). [Contact us](/api/getting-started/help) to request access. See [Provisioned Throughput](/api/token-factory/models#provisioned-throughput).

## At a glance

|                       |                                                                                                                                    |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **Model ID**          | `qwen38-27b`                                                                                                                       |
| **Best for**          | Mid-size reasoning, tool calling, and image understanding at dedicated capacity                                                    |
| **Context window**    | 262,144 tokens                                                                                                                     |
| **Input → output**    | Text and images → text                                                                                                             |
| **Reasoning**         | On by default; turn it off with `reasoning_effort: "none"`. See [Reasoning](#reasoning)                                            |
| **Tool calling**      | Supported, including `tool_choice: "required"`, named functions, and parallel tool calls                                           |
| **Log probabilities** | Supported on [Chat Completion V2](/api-reference/chat/chat-completions-v2) and [Responses](/api-reference/responses/create)        |
| **APIs**              | [`POST /v2/chat/completions`](/api-reference/chat/chat-completions-v2) and [`POST /v2/responses`](/api-reference/responses/create) |
| **Pricing**           | ₹18 input · ₹5 cached input · ₹230 output per 1M tokens; reasoning is billed as output ([Pricing](/api/getting-started/pricing))   |

## Key capabilities

#### Image understanding

Send one or more base64 images alongside text in the same message.

#### Thinking on or off

Reasons by default; set `reasoning_effort: "none"` for direct, low-latency answers.

#### Tool calling

Use OpenAI-compatible `tools` and `tool_choice`, including parallel calls.

#### Streaming

Receive reasoning and answer deltas as server-sent events.

## Quickstart

#### Python

```python
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

response = client.chat.completions_v2(
    model="qwen38-27b",
    messages=[
        {"role": "user", "content": "Explain the difference between TCP and UDP in three bullet points."}
    ],
    max_tokens=2000,
)

print(response.choices[0].message.content.strip())
```

#### JavaScript

```javascript
import { SarvamAIClient } from "sarvamai";

const client = new SarvamAIClient({
    apiSubscriptionKey: "YOUR_SARVAM_API_KEY",
});

async function main() {
    const response = await client.chat.completionsV2({
        model: "qwen38-27b",
        messages: [
            {
                role: "user",
                content: "Explain the difference between TCP and UDP in three bullet points.",
            },
        ],
        max_tokens: 2000,
    });

    console.log(response.choices[0].message.content.trim());
}

main();
```

#### cURL

```bash
curl -X POST https://api.sarvam.ai/v2/chat/completions \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen38-27b",
    "messages": [
      {"role": "user", "content": "Explain the difference between TCP and UDP in three bullet points."}
    ],
    "max_tokens": 2000
  }'
```

The answer in `content` can start with blank lines (`"\n\n"`) when the model has
reasoned first, so trim it before display.

## Reasoning

Qwen 3.8 27B thinks by default. Read the trace from `choices[].message.reasoning_content` on
chat, or from the `reasoning` output item on Responses.

| Value                                                                      | Effect                                                                    |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| Omitted, or `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"` | Thinking on. The levels are accepted but don't change how much it thinks. |
| `"none"`                                                                   | Turns thinking off; the model answers directly.                           |

Set the value with `reasoning_effort` on [Chat Completion V2](/api-reference/chat/chat-completions-v2)
or `reasoning.effort` on [Responses](/api-reference/responses/create). You can also turn thinking off
with `chat_template_kwargs: {"enable_thinking": false}`, sent through `extra_body` in the SDKs.

Reasoning tokens are billed as output tokens and count against `max_tokens` /
`max_output_tokens`.

## Structured output

Turn thinking off when you use structured output. With thinking on, the JSON is written into the
reasoning trace and `content` comes back `null` on chat (on Responses, the output has only a
`reasoning` item).

```python
response = client.chat.completions_v2(
    model="qwen38-27b",
    reasoning_effort="none",
    response_format={"type": "json_object"},
    messages=[
        {"role": "user", "content": "Return JSON with keys city and country for the capital of Japan."}
    ],
)
```

## Image input

Send images as **base64 data URIs** in `image_url` content parts on chat, or `input_image`
parts on Responses. Remote `http(s)` image URLs return `400`. Several images can go in one
message; the model reads them in order.

## Supported parameters

| Parameter                                             |                 Chat Completion V2                 |                               Responses                               |
| ----------------------------------------------------- | :------------------------------------------------: | :-------------------------------------------------------------------: |
| Streaming (`stream`)                                  |                                                    |                                                                       |
| Image input (base64)                                  |                                                    |                                                                       |
| Tool calling (`tools`, `tool_choice`)                 |         `auto`, `none`, `required`, or named       |                                                                       |
| Structured output (`response_format` / `text.format`) |  with thinking off ([details](#structured-output)) |                            with thinking off                          |
| Log probabilities (`logprobs`, `top_logprobs`)        |                                                    |  send `top_logprobs` with `include: ["message.output_text.logprobs"]` |
| Multiple choices (`n` > 1)                            |                        `400`                       |                       N/A — Responses has no `n`                      |
| `top_k`                                               |                                                    |                                  `400`                                |
| Reasoning control                                     |   `reasoning_effort`; `"none"` turns thinking off  |            `reasoning.effort`; `"none"` turns thinking off            |
| Stateful fields (`store`, `previous_response_id`)     |                         N/A                        |                `400`; replay the conversation in `input`              |

`400` is `invalid_request_error`.

## Known limitations

* Text and image input only. Video and audio parts return `400`.
* On Chat Completion V2, a `developer` message returns `400 invalid_request_error`. Use a
  `system` message instead. Responses accepts `developer` input items.
* With thinking on, structured output lands in the reasoning trace instead of `content`. Set
  `reasoning_effort: "none"` (see [Structured output](#structured-output)).
* Reasoning and the final answer share the **`max_tokens`** / **`max_output_tokens`** budget.

## Limits and errors

| Area           | Limit or condition                                                    | API response                                                                                                                         | Recommended action                                                        |
| -------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
| Access         | Your organisation does not have Provisioned Throughput for this model | `404 not_found_error`; the model isn't listed in `GET /v2/models`                                                                    | [Contact us](/api/getting-started/help) to request access.                |
| Context        | Prompt tokens plus `max_tokens` exceed 262,144                        | `400 invalid_request_error`                                                                                                          | Shorten the prompt, send fewer images, or reduce `max_tokens`.            |
| Output         | `max_tokens` exceeds 262,144                                          | `400 invalid_request_error`                                                                                                          | Set `max_tokens` within the context window.                               |
| Media URL      | An image part uses an `http(s)` URL                                   | `400 invalid_request_error`                                                                                                          | Inline the image as a base64 data URI.                                    |
| Modality       | Request includes video or audio input                                 | `400 invalid_request_error`                                                                                                          | Send text or image input.                                                 |
| Messages       | A `developer` message on Chat Completion V2                           | `400 invalid_request_error`: "The 'developer' role is not supported for this model; send these instructions with the 'system' role." | Send the instructions as a `system` message.                              |
| Choices        | `n` > 1                                                               | `400 invalid_request_error`                                                                                                          | Send one request per completion.                                          |
| Reasoning      | Reasoning consumes the full `max_tokens` budget                       | `200` with `finish_reason: "length"`                                                                                                 | Raise `max_tokens` or turn thinking off.                                  |
| Authentication | API key is missing or invalid                                         | `403 invalid_api_key_error`                                                                                                          | Check the `api-subscription-key` header.                                  |
| Model          | Model ID is unknown or unavailable                                    | `404 not_found_error`                                                                                                                | Confirm the ID with [`GET /v2/models`](/api-reference/chat/models-v2).    |
| Quota          | No credits remain                                                     | `402 insufficient_quota_error`                                                                                                       | Add credits in the [dashboard](https://indus.sarvam.ai/billing?ref=docs). |
| Rate limit     | Request or concurrency limit is exceeded                              | `429 rate_limit_exceeded_error`                                                                                                      | Back off and retry.                                                       |