Extended Thinking

Extended thinking is available in the mira-pro and mira-max models. The model's internal reasoning is processed server-side — the API response contains only the final result.

Extended thinking allows the model to reason step-by-step before producing its final answer. This improves accuracy for complex tasks: math, logic, code analysis, and multi-step reasoning.

How It Works

When you use the mira-pro or mira-max model, it generates an internal "chain-of-thought" before the final answer. The reasoning steps are returned in the thinking field of the response, letting you see the model's thought process.

  • ModelUse mira-pro or mira-max to enable reasoning mode.
  • Thinking phaseThe model analyzes the task, breaks it into steps, and verifies its conclusions.
  • Final answerAfter reasoning, the model produces a clean, structured answer.

Basic Example

cURL
curl https://api.vmira.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-mira-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mira-pro",
    "messages": [
      {
        "role": "user",
        "content": "Solve: if I have 3 boxes, each with 5 bags, each bag with 7 apples, how many apples total?"
      }
    ],
    "max_tokens": 4096
  }'

Response Format

The response includes an additional thinking field with the model's intermediate reasoning:

JSON
{
  "id": "chatcmpl-xyz789",
  "model": "mira-pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "There are 105 apples total.\n\n3 boxes * 5 bags * 7 apples = 105 apples.",
        "thinking": "I need to find the total number of apples.\nThere are 3 boxes.\nEach box has 5 bags: 3 * 5 = 15 bags.\nEach bag has 7 apples: 15 * 7 = 105 apples.\nCheck: 3 * 5 * 7 = 105. Correct."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 35,
    "completion_tokens": 120,
    "thinking_tokens": 85,
    "total_tokens": 240
  }
}
Note the thinking_tokens field in usage — this is the number of tokens used during the reasoning phase. They are billed as output tokens.

Comparison: Regular vs Thinking Mode

Aspectmira (regular)mira-pro / mira-max (thinking)
SpeedFast responseSlower (reasoning phase)
Accuracy (complex tasks)GoodSignificantly higher
Token usageStandardHigher (+ thinking_tokens)
TransparencyFinal answer onlyReasoning steps visible

Recommended Use Cases

  • Math and logicComplex calculations, logic puzzles, brain teasers, proofs.
  • Code analysisDebugging, error detection, algorithm optimization, code review.
  • Multi-step analysisData analysis, comparing options, decision-making based on multiple factors.
  • Scientific tasksChemical reactions, physics problems, biological analysis.

Best Practices

Use thinking mode in mira-pro and mira-max only for tasks where accuracy is critical. For simple questions (translation, text generation, chat), the mira model will be faster and cheaper.
  • State the problem clearlyThe clearer the question, the more effectively the model structures its reasoning.
  • Increase max_tokensReasoning consumes extra tokens. Set max_tokens to at least 4096 for complex tasks.
  • Use thinking for debuggingIf the answer is wrong, inspect the thinking field to understand where the model went wrong in its reasoning.

Next Steps