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

string
required
The prompt text. Must be a non-empty string.
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.
boolean
default:"false"
Enable SSE streaming. When true, returns a text/event-stream response instead of JSON. See Streaming.
string
Continue an existing conversation. Pass the conversation ID to maintain multi-turn context.
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.
object[]
Inline tool definitions the model can call during the agent loop.
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
number
Sampling temperature (0–2). Higher values produce more creative output.
integer
default:"8"
Maximum agent loop iterations (1–20). Each iteration is a think → act → observe cycle.
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.
string
default:"theo"
Response format. "theo" for the default format, "openai" for OpenAI-compatible format.
object
Arbitrary key-value metadata attached to the completion. Returned in the response and logged in the audit trail.
string
Component library identifier for GenUI mode. Used by E.V.I. callers for custom UI rendering.
boolean
default:"true"
Set to false to skip long-term memory retrieval and injection for this request. Useful for stateless / privacy-sensitive calls where you don’t want prior memories to influence the answer.
object
Inline conversation envelope for stateless callers — recent messages (max 20) the server uses when no conversation_id is supplied, so follow-ups like “make it longer” resolve against context.
object
Per-request response-style config (format, preciseness, intent) applied on top of the key’s defaults.
object
Per-request personality/trait configuration overlay.
boolean
default:"true"
Master branding toggle. false strips the Theo persona/branding from the system prompt (superset control over persona).
boolean
When true, scopes the response to the key’s brand catalog (Brand Soul) — recommends only your own products/content and redirects off-topic requests.
object[]
Image attachments for vision turns. Each item is either { type: "image_url", url } or { type: "image_base64", data, mime_type } (PNG / JPEG / WebP / GIF, ≤ 15MB base64).
string
Pin the image sub-engine for image mode (otherwise auto).
string
Pin the image quality tier for image mode.
string
Stealth-media model pin (stealth_image / stealth_video).
string
Stealth-media aspect ratio.
string
Stealth-video clip duration.

Request Examples

With Skills and Tools

Response

string
Unique completion ID (prefixed cmpl_).
string
Always "completion".
string
ISO 8601 timestamp.
string
The generated text content.
string
The mode you requested (e.g., "auto").
string
The mode Theo actually used after intent classification (e.g., "fast", "think", "code").
object
The Theo engine that handled the request.
object[]
Tools called during the agent loop.
object[]
Generated files (images, code, documents) produced during the completion.
object[]
Suggested next prompts.
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.
object | null
The metadata you passed in the request, echoed back.
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.
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