Skip to main content
POST
Create Completion
The core endpoint of the Theo API. Sends a prompt through the full orchestration pipeline and returns the complete response.
For real-time token delivery, set stream: true or see Streaming Completions.

Authentication

Requires a Bearer token. See Authentication.

Request Body

prompt
string
required
The prompt text. Must be a non-empty string.
mode
string
default:"auto"
Execution mode. When set to auto, Theo classifies the prompt and selects the optimal engine automatically.Available modes:
  • auto — Classify prompt and route to best engine (default)
  • fast — Low-latency responses for simple queries
  • think — Deep reasoning for complex analysis
  • code — Code generation (Theo Code engine, extended output budget)
  • image — Image generation (Theo Create)
  • videoAsync. Use POST /api/v1/video + job polling, not this endpoint.
  • researchAsync. Use POST /api/v1/research + job polling, not this endpoint.
  • roast — Humorous, irreverent tone
  • genui — Generate interactive UI components (OpenUI Lang)
research and video are asynchronous and must not be sent to /completions (or stream()). They run as background jobs; invoking them here executes the work inline and the request hits the timeout before it finishes. Enqueue them via POST /api/v1/research / POST /api/v1/video and poll with Get Job Status. The @hitheo/sdk throws a TheoUsageError immediately if you pass these modes to complete() / stream(). See the Async Jobs guide.
stream
boolean
default:"false"
Enable SSE streaming. When true, returns a text/event-stream response instead of JSON. See Streaming.
conversation_id
string
Continue an existing conversation. Pass the conversation ID to maintain multi-turn context.
skills
string[]
Skill slugs to activate for this request. These are merged with the user’s installed skills.Each slug activates a skill’s prompt extension, tools, and model preferences for this completion. You can find slugs in the dashboard (copy icon on each skill card), via GET /api/v1/skills, or in the E.V.I. Canvas Input node.See Activating Skills via API for the full guide.
tools
object[]
Inline tool definitions the model can call during the agent loop.
persona
string | object
default:"theo"
Override Theo’s personality for this request.
  • "theo" — Default Theo persona
  • "none" — No persona (raw model output)
  • { "system_prompt": "You are..." } — Custom system prompt
temperature
number
Sampling temperature (0–2). Higher values produce more creative output.
max_iterations
integer
default:"8"
Maximum agent loop iterations (1–20). Each iteration is a think → act → observe cycle.
model_overrides
object
Override the engine used for specific modes. Keys are mode names (e.g., "code", "think"), values are Theo engine IDs (e.g., "theo-1-reason", "theo-1-flash"). See List Models for valid engine IDs.
format
string
default:"theo"
Response format. "theo" for the default format, "openai" for OpenAI-compatible format.
metadata
object
Arbitrary key-value metadata attached to the completion. Returned in the response and logged in the audit trail.
component_library
string
Component library identifier for GenUI mode. Used by E.V.I. callers for custom UI rendering.

Request Examples

With Skills and Tools

Response

id
string
Unique completion ID (prefixed cmpl_).
object
string
Always "completion".
created
string
ISO 8601 timestamp.
content
string
The generated text content.
mode
string
The mode you requested (e.g., "auto").
resolved_mode
string
The mode Theo actually used after intent classification (e.g., "fast", "think", "code").
model
object
The Theo engine that handled the request.
tools_used
object[]
Tools called during the agent loop.
artifacts
object[]
Generated files (images, code, documents) produced during the completion.
follow_ups
object[]
Suggested next prompts.
usage
object
Token counts and cost.
For non-text modes (image, video, tts, stt), prompt_tokens and completion_tokens are always 0 — tokens are not a meaningful billing unit there. Use usage.cost_cents as the sole usage metric for those modes.
metadata
object | null
The metadata you passed in the request, echoed back.
conversation_id
string | null
The server-side conversation id this turn resolved against. null when no conversation was created or attached. Echoed unchanged when you passed conversation_id in the request.
request_id
string
Server-assigned request identifier (also returned as the X-Request-Id header). Include this in support tickets so we can look up the request in logs.

Example Response

OpenAI-Compatible Format

Pass format: "openai" to receive responses in OpenAI’s chat.completions format. This allows drop-in replacement in existing OpenAI-based applications.
The response follows the OpenAI chat.completion schema with choices, usage, and model fields.

Semantic Caching

Non-conversation completions (no conversation_id) are automatically cached. Identical requests return cached results instantly at zero cost. See Semantic Caching. Cached responses include "_cached": true in the response body.

Errors