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

# Reasoning

Reasoning Models are designed for more complex task scenarios, such as math problem solving, code generation, logical analysis, and multi-step reasoning. They provide OpenAI-compatible interfaces and support streaming output, making them easy to integrate into existing applications.

Representative models include:

* `Qwen/Qwen3-32B`
* `Qwen/Qwen3.6-27B`
* `Qwen/Qwen3.5-397B-A17B`
* `kimi-k2.6`

These models return their chain-of-thought in a separate `reasoning` field.

For the full model list and pricing, refer to [Models](https://console.scitix.ai/model-inference/models).

## Core Capabilities

* **Structured thinking**: Break complex problems into smaller and clearer steps through chain-of-thought (CoT).
* **Knowledge fusion**: Combine general knowledge with domain-specific context to improve coverage and accuracy.
* **Self-correction**: Add validation and reflection during generation to improve result reliability.
* **Multimodal processing**: Some models support mixed inputs, such as text, code, and formulas. For details, refer to the corresponding model details.

## Usage Notes

* Before moving to production, check each model's context limits, whether it supports `thinking_budget`, pricing, and concurrency limits.
* Not every model emits a `reasoning` field. General-purpose chat models, such as `DeepSeek-V4-Flash`, answer directly without exposing a separate chain-of-thought.

## Key Parameters

### Parameter Description

* **Request parameters**

  * `thinking_budget`: Token budget for internal reasoning. It can be used to balance reasoning depth and response latency.
  * `max_completion_tokens`: Token limit for user-visible output, used to avoid overly long responses.

* **Context**

  `context_length` is not a request parameter. The maximum context length supported by each model can be viewed in [Models](https://console.scitix.ai/model-inference/models).

* **Response fields**

  * `reasoning`: Chain-of-thought content, at the same level as `content` in the response object.
  * `content`: The final answer content shown to end users.

### Recommendations

* `thinking_budget` is a hint, not a hard limit. Some models use it to adjust the amount of reasoning, while others may only partially apply it or even ignore it. Do not treat it as an exact limit.
* The reasoning process and final answer share the `max_completion_tokens` budget. If `max_completion_tokens` is set too low, reasoning content may consume the budget, causing `content` to be empty with `finish_reason: length`. We recommend increasing `max_completion_tokens` appropriately or controlling reasoning length through `thinking_budget` to leave enough room for the final answer.
* If the output exceeds `max_completion_tokens`, or the total input exceeds `context_length`, the response will be truncated and `finish_reason` will be set to `length`.

For tailored parameter recommendations, for example for math reasoning, code workflows, or evaluation baselines, share your goals and constraints, and we can suggest best-practice configurations.

## Notes

* **Streaming vs. non-streaming**: Use streaming when you need long output or real-time feedback; use non-streaming when you need to receive the complete result at once.
* **Latency and stability**: Tune `thinking_budget`, `max_completion_tokens`, and client timeout settings to reduce the risk of 504 errors and request timeouts.
* **Quota and concurrency**: Configure rate limiting strategies with pricing in mind, based on [Models](https://console.scitix.ai/model-inference/models). Implement exponential backoff on the client side when necessary.

## Billing

* **Formula**: Total cost = (input tokens x input unit price) + (output tokens x output unit price).
* **Pricing**: Check the model detail page in [Models](https://console.scitix.ai/model-inference/models) for each model's pricing.

## Examples

The examples read the API key from an environment variable to avoid writing secrets into code.

```bash theme={null}
export API_KEY="YOUR_API_KEY"
```

### Streaming Request

```python theme={null}
import os
from openai import OpenAI

BASE_URL = "https://api.scitix.ai/model-api"
API_KEY = os.environ["API_KEY"]

client = OpenAI(base_url=BASE_URL, api_key=API_KEY)

messages = [{"role": "user", "content": "Which is the largest anime website in China?"}]

content = ""
reasoning = ""

resp = client.chat.completions.create(
    model="Qwen/Qwen3-32B",
    messages=messages,
    stream=True,
    max_completion_tokens=4096,
    extra_body={"thinking_budget": 1024},
)

for chunk in resp:
    if not chunk.choices:
        continue
    delta = chunk.choices[0].delta
    if getattr(delta, "content", None):
        content += delta.content
        print(delta.content, end="", flush=True)
    if getattr(delta, "reasoning", None):
        reasoning += delta.reasoning

# Optionally persist the reasoning text for debugging/audit

# Round 2 (continue the conversation)
messages.append({"role": "assistant", "content": content})
messages.append({"role": "user", "content": "Continue"})

resp2 = client.chat.completions.create(
    model="Qwen/Qwen3-32B",
    messages=messages,
    stream=True,
)

for chunk in resp2:
    if not chunk.choices:
        continue
    delta = chunk.choices[0].delta
    if getattr(delta, "content", None):
        print(delta.content, end="", flush=True)
```

### Non-Streaming Request

```python theme={null}
import os
from openai import OpenAI

BASE_URL = "https://api.scitix.ai/model-api"
API_KEY = os.environ["API_KEY"]

client = OpenAI(base_url=BASE_URL, api_key=API_KEY)

messages = [{"role": "user", "content": "Which is the largest anime website in China?"}]

resp = client.chat.completions.create(
    model="Qwen/Qwen3.5-397B-A17B",
    messages=messages,
    stream=False,
    max_completion_tokens=4096,
    extra_body={"thinking_budget": 1024},
)

content = resp.choices[0].message.content
reasoning = getattr(resp.choices[0].message, "reasoning", "")
finish_reason = resp.choices[0].finish_reason

# Round 2 (continue the conversation)
messages.append({"role": "assistant", "content": content})
messages.append({"role": "user", "content": "Continue"})

resp2 = client.chat.completions.create(
    model="Qwen/Qwen3.5-397B-A17B",
    messages=messages,
    stream=False,
)

print(resp2.choices[0].message.content)
```

## FAQ

* **How should I handle very long text?**
  Adjust `max_completion_tokens` and enable `stream=True` to reduce timeout risk. Context limits vary by model; refer to [Models](https://console.scitix.ai/model-inference/models) for details.
* **What if the chain-of-thought is too long and gets truncated?**
  Lower `thinking_budget` or increase the client timeout, and make sure `max_completion_tokens` is set to a reasonable value.
* **Why can't I see `reasoning`?**
  Only some reasoning models return this field. Refer to each model's documentation.
