Skip to content

Documentation

Everything you need to use TemuClaude — 8 models, 10-layer pipeline, one superior answer.

Quickstart

Get started with TemuClaude in under 5 minutes.

Option 1 — Use the playground (no installation):

Open the playground → — ask anything, get a superior answer. No signup, no setup. 20 free queries/day.

Option 2 — API access:

bashCopy
curl -X POST https://temuclaude.com/api/chat \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "What is 9.9 vs 9.11?"}]}'

# Response: SSE stream with answer + orchestration metadata

Tip: The playground runs the full 10-layer orchestration stack — you get the same quality as our API. Free tier: 20 queries/day, no signup required.

Architecture

TemuClaude is one endpoint that orchestrates 8 AI models behind the scenes. When you ask a question, it:

  1. Classifies your query (math, coding, reasoning, knowledge, creative, legal, health, agentic)
  2. Estimates difficulty (trivial, medium, hard)
  3. Routes to the best strategy:
    • Trivial (60%) → single cheap model (Hy3 Preview, free models)
    • Medium (30%) → specialist model (DeepSeek V4 Pro, GLM-5.2, Gemini 3 Flash)
    • Hard (10%) → full 10-layer fusion stack (3 models parallel + cross-review + aggregate + verify + QA + debate)
  4. Returns one clean answer — orchestration is invisible but visible in the playground

Note: All of this happens server-side. The user never picks models, modes, or parameters. They just ask TemuClaude.

Model Pool

TemuClaude uses 8 models, each with a specific role:

ModelRoleIQContext
GLM-5.2Orchestrator + Aggregator511M
DeepSeek V4 ProHard reasoning + Math + Coding441M
Hy3 PreviewTrivial router (cheapest)262K
Gemini 3 FlashLegal + Health specialist501M
MiniMax M3Vision + Creative441M
MiMo-V2.5Multimodal (text+image+video)401M
Claude Sonnet 5Frontier fallback (hardest 2%)531M
Nemotron 3 UltraQA Gate (FREE, 550B MoE)38128K

Tip: Nemotron 3 Ultra is free on OpenRouter — the quality gate costs nothing. Claude Sonnet 5 (IQ 53) is only used for the hardest 2% of queries where all other layers fail.

10-Layer Pipeline

For hard queries, TemuClaude runs up to 10 quality layers. Each is independently validated by published research:

  1. Web Search — DuckDuckGo for knowledge queries (free, unlimited)
  2. MoA 3-Layer Fusion — Propose → Cross-Review → Aggregate (65.1% AlpacaEval vs GPT-4o 57.5%)
  3. Self-Consistency — PRM-weighted voting across N samples (+18.4% MATH)
  4. Code Verification — Execute Python, verify output (ground truth)
  5. Reflexion — Verbal reflection on failure, retry with context (91% HumanEval)
  6. Self-QA Gate — 5-rubric score (LC, FC, CM, GA, CL), retry if < 8/10
  7. Z3/SMT Verification — Logical consistency check with SMT solver
  8. Budget Forcing — Append "Wait" to force longer reasoning (s1 paper)
  9. Step-Level Verification — Verify each reasoning step independently (rStar-Math)
  10. Frontier Fallback — Escalate to Claude Sonnet 5 (IQ 53) for hardest 2%

3-Tier Routing

TemuClaude routes queries by difficulty to minimize cost without sacrificing quality:

textCopy
Difficulty estimation:
  Word count → 0-5 points
  Task type (math/reasoning/coding) → +2 points
  Keywords (explain, analyze, compare) → +1-2 points
  Total → 0-10 scale

Routing:
  Trivial (60% of queries) → 1 cheap model, 500 tokens
    Models: Hy3 Preview, free models ($0.00)
    
  Medium (30% of queries) → 1 specialist model, 4096 tokens
    Math/Coding → DeepSeek V4 Pro
    Knowledge → GLM-5.2
    Legal/Health → Gemini 3 Flash
    Creative → MiniMax M3
    
  Hard (10% of queries) → Full 10-layer fusion stack, 8192 tokens
    3 models in parallel → cross-review → aggregate
    + code verification + self-QA + reflexion + debate

Note: 60% of queries cost $0 (free models or cache). 30% cost $0.06-0.14/M. Only 10% use the full pipeline. Average cost: $0.05/M tokens.

MoA 3-Layer Fusion

For hard queries, TemuClaude uses Mixture-of-Agents (MoA) with 3 layers:

textCopy
Layer 1: 3 models propose independently
  GLM-5.2 → response A
  DeepSeek V4 Pro → response B
  Gemini 3 Flash → response C

Layer 2: Cross-Review
  GLM-5.2 reviews B and C → improved A'
  DeepSeek reviews A and C → improved B'
  Gemini reviews A and B → improved C'

Layer 3: Aggregation
  GLM-5.2 synthesizes A' + B' + C' → final answer
  With structured analysis: consensus, contradictions, insights, blind spots

Note: Research: 3-layer MoA achieves 65.1% on AlpacaEval 2.0 vs GPT-4o's 57.5%. Each layer adds measurable quality.

Self-Consistency

For math and reasoning questions, TemuClaude generates N samples and votes:

  • Math: 3 samples at temperature 0.7
  • Reasoning: 2 samples
  • Each sample scored by Nemotron (PRM-weighted voting)
  • Highest-scoring answer selected as final

Code Verification

For math and coding questions, TemuClaude generates Python code, executes it in a sandbox, and returns the verified output:

  1. Model generates code to solve the problem
  2. Code executed in sandboxed subprocess (no network, temp dir, timeout)
  3. If output matches → answer is verified (ground truth)
  4. If execution fails → trigger Reflexion: model reflects, retries

Self-QA Gate

Every answer is scored on 5 rubrics (USVA framework, extended from ATTS):

  • LC — Logical Coherence (is the reasoning consistent?)
  • FC — Factual Correctness (are the facts right?)
  • CM — Completeness (does it address all parts?)
  • GA — Goal Alignment (does it answer what was asked?)
  • CL — Clarity (is it clear, concise, accessible?)

Score = average × 10. If score < 8/10, TemuClaude retries with Reflexion feedback — up to 2 times.

Reflexion

When the QA gate fails, TemuClaude generates a verbal reflection on what went wrong, then retries with that context:

textCopy
1. QA gate fails (score < 8/10)
2. Nemotron generates reflection:
   "The answer has a logical error in step 3.
    The formula should use integration by parts,
    not substitution. Fix this and retry."
3. Original model retries with reflection as context
4. New answer is re-scored on all 5 rubrics
5. If still failing, retry once more (max 2 retries)

Tip: Reflexion achieves 91% on HumanEval (vs 80% without). The difference between a model that gives up and one that learns from mistakes.

Budget Forcing

If the answer is suspiciously short for a hard problem, TemuClaude appends "Wait" to force the model to continue reasoning (s1 paper, arXiv:2501.19393):

textCopy
Model answer: "The answer is 42."
  → Too short for a hard math problem
  → Append "Wait"
  → Model continues: "Let me verify... [longer reasoning]"

Z3 Logical Verification

For reasoning questions, TemuClaude extracts logical claims and checks them with a Z3 SMT solver:

  • Extracts "if X then Y", "X implies Y" patterns
  • Encodes as Z3 boolean constraints
  • Checks satisfiability (no contradictions)
  • If contradiction found → triggers multi-agent debate

Note: Requires z3-solver: pip install z3-solver. Falls back gracefully if not installed.

Frontier Fallback

For the hardest 2% of queries where all other layers score low, TemuClaude escalates to Claude Sonnet 5 (IQ 53 — the highest available):

  • Only triggers when QA score < 0.75 after all retries
  • Query must match frontier criteria (prove, derive, theorem, system design, refactor)
  • Frontier model gets the previous best answer as context
  • Re-scored — if better, replaces the answer

Methodology

TemuClaude's benchmark scores are projected from:

  1. Individual model scores from ArtificialAnalysis Intelligence Index
  2. Proven improvement numbers from published research papers
  3. Stack effects: each technique's proven gain applied to the baseline
  4. Conservative estimates (lower bounds of published ranges)

Warning: These are projected scores, not live-verified. We will publish live results after ArtificialAnalysis testing. We are committed to transparency.

Reproducibility

Full benchmark scripts are available on GitHub (MIT licensed). Run them yourself:

bashCopy
# Clone the repo
git clone https://github.com/notSaiful/temuclaude.git
cd temuclaude-research

# Install dependencies
pip install -r requirements.txt

# Run TemuClaude on HLE benchmark
python benchmarks/run_temuclaude.py --dataset hle --sample 100

# Run on GPQA Diamond
python benchmarks/run_temuclaude.py --dataset gpqa --sample 100

View full results on GitHub →

Projected Scores

TemuClaude vs frontier models across 8 benchmarks:

BenchmarkTemuClaude*Claude Sonnet 5GPT-5.5
GPQA Diamond95-98%88%94%
LiveCodeBench96-99%87%91%
SWE-Bench Pro75-85%70%68%
Terminal-Bench91-96%85%82%
GDPval-AA v21824+17831700
MultiChallenge87-94%82%85%
MRCR v20.8-1.00.720.68
HLE45-55%53%41%

* Projected from research analysis. Live results pending ArtificialAnalysis verification.

REST API

TemuClaude exposes a single endpoint:

bashCopy
POST /api/chat

Request:
{
  "messages": [
    {"role": "user", "content": "What is 9.9 vs 9.11?"}
  ]
}

Response: SSE stream
  data: {"chunk": "9.9"}
  data: {"chunk": " is"}
  data: {"chunk": " larger"}
  ...
  data: {"orchestration": {...}}
  data: [DONE]

Streaming

TemuClaude uses Server-Sent Events (SSE) for streaming responses:

  • POST request with messages array
  • SSE response — chunks stream as data: {chunk}
  • Orchestration data — sent after all chunks, before [DONE]
  • [DONE] — signals stream end

Orchestration Data

The final SSE event contains orchestration metadata showing exactly how the answer was built:

jsonCopy
{
  "orchestration": {
    "taskType": "math",
    "tier": "hard",
    "models": [
      {"name": "glm-5.2", "response": "...", "latency": 3.2, "correct": true},
      {"name": "deepseek-v4-pro", "response": "...", "latency": 8.3, "correct": true},
      {"name": "gemini-3-flash", "response": "...", "latency": 13.9, "correct": true}
    ],
    "aggregator": "glm-5.2",
    "consensus": 3,
    "qaScore": 8,
    "codeVerified": true,
    "totalLatency": "48.2",
    "cost": "$0.015",
    "techniques": ["moa-3-layer", "cross-review", "structured-aggregation",
                   "self-consistency", "prm-weighted-voting", "code-verification",
                   "reflexion", "usva-5-rubric-qa", "s1-budget-forcing"]}
  }
}

Tip: The techniques array shows exactly which layers were activated. Full transparency — no black boxes.

Authentication

Free tier: no authentication needed. Paid plans use Bearer token:

bashCopy
curl -X POST https://temuclaude.com/api/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "Hello"}]}'

Rate Limits

PlanRequests/minQueries/day
Free1020
Developer10050,000/mo
Pro1,000500,000/mo
Enterprise10,000Unlimited

Error Codes

CodeMeaning
400Bad request — missing messages field
401Unauthorized — invalid or missing API key
429Rate limit exceeded — upgrade your plan
500Internal error — all models unavailable

Media Orchestration

TemuClaude also orchestrates media generation — images, video, text-to-speech, and music. Same 10-stage pipeline (cache, intent, tier, parallel generation, judge, quality gate, reflexion, memory, return). Each media type has its own model pool, routing logic, and quality gates.

Note: Media orchestration requires an AIML API key (set AIML_API_KEY env var). The LLM orchestration works with just OpenRouter.

Image Generation

3-tier routing with best-of-N generation and LLM judge:

TierModelsCost/image
DraftZ-Image-Turbo (ELO 1105)$0.005
StandardReve Image (ELO 1281), FLUX-2 Pro (ELO 1186), MAI Image 2.5 (ELO 1272)$0.031-0.048
PremiumReve, MAI 2.5, Nano Banana 2, FLUX-2 Max, GPT Image 2 (ELO 1340)$0.031-0.211

Unique routing for special cases:

  • Vector/SVG output → Recraft V3
  • Text in images → FLUX-2 Flex, GPT Image 2
  • Extreme aspect ratios → Nano Banana 2
  • Character consistency → Nano Banana 2, GPT Image 2
  • Multilingual text → Seedream 4.5
bashCopy
# Generate an image
curl -X POST https://temuclaude.com/api/media/generate \
  -H "Content-Type: application/json" \
  -d '{"type": "image", "prompt": "a cat on a windowsill", "tier": "standard"}'

Video Generation

3-tier routing with async submit/poll pattern:

TierModelsCost/min
DraftLTXV-2 Fast (ELO 976)$2.40
StandardSeedance 2.0 (ELO 1225), HappyHorse 1.0 (ELO 1131)$9.07-13.20
PremiumSeedance 2.0, HappyHorse, Kling V3 Pro (4K/60fps)$9.07-20.16

Unique routing for special cases:

  • 4K video → Kling V3 Pro
  • Dialogue/lip-sync → Google Veo 3.1
  • Multi-input (images + clips + audio) → Seedance 2.0
  • Long-form video → LTXV-2

Text-to-Speech

3-tier routing with voice selection and quality gating:

TierModelsCost/1K chars
DraftQwen3-TTS Flash (119 languages, 80ms latency)$0.013
StandardElevenLabs Turbo V2.5, MiniMax Speech 2.6, VibeVoice 7B$0.052-0.117
PremiumElevenLabs V3 Alpha, Hume Octave 2, MiniMax Speech 2.6 HD$0.078-0.234

Music Generation

3-tier routing with lyrics support and quality gating:

TierModelsCost/song
DraftMiniMax Music 2.0 (vocals, 240s max)$0.032
StandardMiniMax Music 2.0 + Music 1.5 (ethnic instruments)$0.032-0.15
PremiumMusic 2.0 + Music 1.5 + Music 2.6 (frontier, 300s max)$0.032-0.20

Tip: All music models support lyrics input. TemuClaude's judge scores musicality, prompt adherence, vocal quality, audio quality, and structure — same 5-rubric quality gate as the LLM pipeline.

Docker

Run TemuClaude with Docker (MIT licensed):

bashCopy
# Build the image
docker build -t temuclaude .

# Run on port 8000 with OpenRouter
docker run -p 8000:8000 -e OPENROUTER_API_KEY=your-key temuclaude

# Or with Ollama backend
docker run -p 8000:8000 -e OLLAMA_API_BASE=http://host.docker.internal:11434 temuclaude

Fly.io

Deploy to Fly.io (Mumbai region for lowest latency to India):

bashCopy
# Install flyctl
curl -L https://fly.io/install.sh | sh

# Login and create app
fly auth login
fly launch --image temuclaude

# Deploy
fly deploy

# Set secrets
fly secrets set OPENROUTER_API_KEY=your-key

Tip: Fly.io's Mumbai region gives ~20ms latency to India.

Environment Variables

VariableRequiredDescription
OPENROUTER_API_KEYYesOpenRouter API key for model access
AIML_API_KEYNoAIML API key (fallback backend)
TEMUCLAUDE_MASTER_KEYNoMaster key for API authentication

Edit this page on GitHub → · MIT Licensed