> ## Documentation Index
> Fetch the complete documentation index at: https://docs.instructorphp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Llm qwen

## Overview

QwenCloud exposes an OpenAI-compatible Chat Completions API. The bundled
`qwen` provider uses the DashScope international endpoint and the
`QWEN_API_KEY` environment variable.

Inference feature compatibility:

* tool calling (supported; `required` is sent as `auto`)
* native JSON object response\_format (supported)
* native JSON Schema response\_format (supported by Qwen3.8-Max and selected
  Qwen3.7 models; older models degrade to JSON object)
* thinking controls (`enable_thinking` and `reasoning_effort`) (supported)
* Instructor markdown-JSON fallback (fallback)

## Example

```php theme={null}
<?php

use Cognesy\Messages\Messages;
use Cognesy\Polyglot\Inference\Inference;
use Cognesy\Utils\Str;

require 'examples/boot.php';

$answer = Inference::using('qwen')
    ->with(
        messages: Messages::fromString('What is the capital of France?'),
        options: [
            'enable_thinking' => false,
            'max_tokens' => 64,
        ],
    )
    ->get();

echo "USER: What is the capital of France?\n";
echo "ASSISTANT: $answer\n";
assert(Str::contains($answer, 'Paris'));
?>
```
