curl example, choose your Cloud region. For authenticated calls, it must be the same region as your key. The examples below use MIROBODY_API_BASE:
Endpoint
stream: true for SSE.
It is deliberately closed — no client tools, no response formatting, no multi-turn state. That makes it easy to embed: call it directly, or wrap it as one tool inside your own agent. If you need client-side tools, stored conversations, or previous_response_id chaining, use the Agent API (POST /v1/responses).
All /v1 endpoints share one base URL — pick the cluster your account uses:
/v1 — it serves its own /api/* routes and an /mcp endpoint, described in the Self-Host Mirobody.
Japan and EU clusters are in preparation — see Regions. Model providers and pricing can differ by region, so read GET /v1/models from the cluster you call.
Quickstart
Set the key for the same region asMIROBODY_API_BASE before running any example:
Request body
The
user field is the tenant-isolation key. The backend maps (your account, user) to an internal Subject, and Subjects are fully isolated from one another — pass each end-user’s stable id and no user ever sees another’s data. Omit it and the call falls back to your account’s default Subject. Subjects are invisible to the Mirobody web app and to other developers.The value is normalized (trimmed + lowercased) before mapping, so Alice and alice resolve to the same Subject. Pass a stable, canonical id.retention and session_id are not fields on this stateless surface. Set retention when writing data, files, or readings stored by /v1/standardize. For server-side conversation state, use the Agent API.
Unsupported parameters
This surface is a closed grounded completion — tools run server-side only, and the answer is free-form text. Parameters that contradict that are explicitly rejected with400 (code: unsupported_parameter, param names the offender) rather than silently swallowed:
Sampling parameters are accepted but ignored (industry norm for agent-backed surfaces):
max_tokens doesn’t cap output; temperature, top_p, stop, and seed have no effect. The response always contains a single choice.reasoning_effort is honored ("low" | "medium" | "high"): it maps to the underlying model’s extended-thinking / reasoning budget. The reasoning streams as delta.reasoning_content and is included as message.reasoning_content in the non-stream response; usage.completion_tokens_details.reasoning_tokens counts it. Omit it for the model’s default; models without a thinking mode ignore it.Response
message.content carries one clean final answer. Optional provider reasoning text and server tool calls use separate channels, so the answer itself is not mixed with tool narration.
reasoning_content and tool_steps are additive channels — clients that only read message.content keep working.
Usage accounting
usage.prompt_tokens reports the input you actually sent (your messages); the platform’s system prompt and tool schemas are reported separately in prompt_tokens_details.system_tokens. completion_tokens_details.reasoning_tokens reports provider reasoning tokens. Counts are summed across every model call in the agent turn.
usage.billed_tokens is the actual token total you’re metered on. Multiplying it by the catalog’s standard input/output rates gives a cost estimate; prompt-cache discounts can make actual metered cost lower.
Streaming
Withstream: true, frames arrive in order. The first chunk carries delta.role: "assistant" (OpenAI parity — many clients key message init off it), then optional reasoning/tool deltas, then a single uninterrupted answer stream:
tool_steps by id (streamed steps carry {id, name, arguments}; full result payloads are available on the non-stream response). The final frame (before [DONE]) carries the top-level health_records / citations and usage. An upstream failure arrives as an SSE {"error": ...} frame before the stream ends. Clients that only read delta.content keep working.
System prompts
Asystem message sets the tone, persona, format, and language of the answer. Server-tool availability and Subject scoping remain platform-controlled; the prompt cannot grant access to another Subject or add tools.
Built-in tools
Beyond plain tool-calling, the hosted agent can plan multi-step work, delegate subtasks, run sandboxed code for numeric analysis (trends, correlations), and read the Subject’s uploaded files. You don’t invoke any of this — the agent does, against the Subject’s data. The tools the hosted agent can call:query_health_data— search and aggregate the Subject’s recordslist_family_members— resolve care-circle members the Subject is allowed to querysearch_medical_evidence— search literature, guidelines/consensus, and registered trials (feedscitations)read_source— read one result by its returned ref; arbitrary URL fetching is not supported
/v1 agent’s main loop is read-only. Health facts mentioned in stored conversations are extracted automatically (see State & memory), not written by a tool during the answer. Planning, delegation, and code-analysis tools are internal and not part of the API contract. ask_user serves the web app but is disabled on the /v1 surfaces because an API caller has no widget to answer it. Files uploaded through /v1/files become readable to the agent once processed.
To add your own tools, use the Agent API’s function calling — this surface intentionally has no tool injection.
Charts (vis-chart)
When the answer involves a trend / comparison / distribution, it may embed a fenced```vis-chart block of pure-data JSON ({type, title, axisXTitle, axisYTitle, data}). Rendering is the client’s job — the API only returns the data spec. Detect the fenced block and render it (line / area / bar / pie).
See also
- Agent API (Responses) — the full agent surface, with your own tools and stored state.
- Use the Answers API as a Tool — wrapping this endpoint as one tool inside your own agent.
- Streaming — the SSE frames this endpoint emits.