POST /api/v1/completions, Theo runs a multi-stage orchestration pipeline — not a single model call. You send one request, and Theo handles classification, routing, skill injection, tool execution, fallback, and billing automatically.
The Pipeline
Stage 1: Intent Classification
When you sendmode: "auto" (the default), Theo classifies your prompt to determine the best execution mode.
Theo uses a multi-tier classification system that combines fast heuristics with AI-powered analysis to accurately route your request. Obvious signals (e.g., “Draw me a logo” → image) are detected instantly. Ambiguous prompts are analyzed more deeply.
Override:
If you pass mode: "code" explicitly, classification is skipped entirely.
The resolved mode determines which Theo engine handles the request, what system prompt is used, and which follow-up suggestions are offered.
Stage 2: Skill Loading
Skills are loaded from two sources:- Installed skills — persistent skills loaded on every request
- Per-request skills — skill slugs passed in the
skills[]array, loaded on-demand
- System prompt extension — domain-specific instructions injected into the context
- Tool definitions — callable actions the engine can invoke
- Engine preference — the skill can recommend which Theo engine handles its tasks best
Stage 3: Engine Routing
Theo selects the optimal engine based on the resolved mode: || Mode | Engine | Description | ||------|--------|-------------| || fast / auto |theo-1-flash | Fast, lightweight completions |
|| think | theo-1-reason | Deep reasoning and analysis |
|| code | theo-1-code | Production-quality code generation |
|| image | theo-1-create | Image generation |
|| video | theo-1-motion | Video generation |
|| research | theo-1-research | Multi-step web research |
|| roast | theo-1-edge | Unfiltered humor |
|| genui | theo-1-genui | Generative UI components |
If the primary engine is unavailable, Theo automatically fails over to a backup — you never see a broken response.
Stage 4: Agent Loop
For requests with available tools, Theo enters an iterative agent loop:Stage 5: Response
The final response includes:content— the generated textmodel— which Theo engine handled it (e.g.,theo-1-reason)tools_used— which tools were called and their statusartifacts— any generated files (images, code, documents)follow_ups— suggested next promptsusage— token counts and cost in cents
