UniterRouter
API ReferenceOpenAI Compatible

Reasoning Models

OpenAI o1, o3 Reasoning API - Advanced AI reasoning for math, coding, and complex problems. Access reasoning models through UniterRouter with extended thinking and chain-of-thought.

Reasoning Models

Reasoning models like o1 and o3 use extended thinking to solve complex problems in math, coding, and science.

Available Models: o1, o1-mini, o1-preview, o3-mini, and provider-specific reasoning models like deepseek-reasoner.

How It Works

Reasoning models "think" before responding:

  1. Analyze the problem internally
  2. Break down into steps
  3. Generate chain-of-thought
  4. Produce final answer

Basic Usage

from openai import OpenAI

client = OpenAI(
    base_url="https://api.uniterouter.ai/v1",
    api_key="your_api_key",
)

response = client.chat.completions.create(
    model="o1",
    messages=[
        {
            "role": "user",
            "content": "Solve: If a train travels 120km in 2 hours, then stops for 30 minutes, then travels 90km in 1.5 hours, what is the average speed for the entire journey?"
        }
    ]
)

print(response.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.uniterouter.ai/v1",
  apiKey: process.env.UNITEROUTER_API_KEY,
});

const response = await client.chat.completions.create({
  model: "o1",
  messages: [
    {
      role: "user",
      content: "Prove that the square root of 2 is irrational",
    },
  ],
});

console.log(response.choices[0].message.content);
curl https://api.uniterouter.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $UNITEROUTER_API_KEY" \
  -d '{
    "model": "o1",
    "messages": [
      {"role": "user", "content": "Write a proof that there are infinitely many prime numbers"}
    ]
  }'

Reasoning Effort

Control how much the model thinks (o1 and o3):

response = client.chat.completions.create(
    model="o3-mini",
    messages=[{"role": "user", "content": "Solve this complex integral..."}],
    reasoning_effort="high"  # "low", "medium", "high"
)
LevelUse CaseTokens
lowSimple problemsFewer
mediumBalanced (default)Moderate
highComplex problemsMore

Model Comparison

ModelBest ForSpeedCost
o1Complex reasoningSlowerHigher
o1-miniFaster reasoningMediumMedium
o3-miniBalancedFastLower
deepseek-reasonerCost-effectiveFastLowest

DeepSeek Reasoner

Access DeepSeek's reasoning model:

response = client.chat.completions.create(
    model="deepseek-reasoner",
    messages=[
        {"role": "user", "content": "Explain the P vs NP problem"}
    ]
)

# Access reasoning content if available
if hasattr(response.choices[0].message, 'reasoning_content'):
    print("Thinking:", response.choices[0].message.reasoning_content)
print("Answer:", response.choices[0].message.content)

Use Cases

DomainExample
MathematicsProofs, complex calculations
CodingAlgorithm design, debugging
ScienceResearch analysis, hypothesis
LogicPuzzles, deduction
PlanningMulti-step strategies

Example: Complex Math

response = client.chat.completions.create(
    model="o1",
    messages=[{
        "role": "user",
        "content": """
        Find all positive integers n such that n^2 + 1 divides n! + 1.
        Show your work step by step.
        """
    }]
)

Example: Code Analysis

response = client.chat.completions.create(
    model="o1",
    messages=[{
        "role": "user",
        "content": """
        Analyze this algorithm and determine its time complexity:
        
        def mystery(n):
            if n <= 1:
                return 1
            return mystery(n-1) + mystery(n-2)
        
        Also suggest an optimized version.
        """
    }]
)

Limitations

  • No streaming - Most reasoning models don't support streaming
  • No system messages - o1 models ignore system prompts
  • Higher latency - Thinking takes time
  • Token usage - Reasoning tokens count toward limits

Best Practices

  1. Be specific - Clear problem statements get better reasoning
  2. One problem at a time - Focus on single complex tasks
  3. Skip simple tasks - Use GPT-4o for straightforward questions
  4. Verify outputs - Always validate mathematical/logical results
  5. Consider cost - Use o1-mini or o3-mini for less critical tasks

How is this guide?