> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirobody.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Create a key in the console and make your first /v1 call.

Mirobody's hosted API is **OpenAI-compatible**: point any OpenAI SDK at `https://test-mirobody-api.thetahealth.ai/v1`, pass an `mb_live_*` key, and the agent answers from each end-user's real health data.

<Note>
  Account management — **API keys, usage, and a live Playground** — lives in the developer console at [**test-platform.mirobody.ai**](https://test-platform.mirobody.ai/). These docs are a reference and guide; the console is where you sign in and manage everything.
</Note>

<Info>
  **Live today:** build against the global **test** cluster — API `https://test-mirobody-api.thetahealth.ai/v1`, console [test-platform.mirobody.ai](https://test-platform.mirobody.ai/). Production is provisioning; the China **test** environment is now live too ([Regions](/en/api-reference/regions/overview)). The console defaults to Chinese — use the language switch (top-right) for English.
</Info>

<Steps>
  <Step title="Sign in & get an API key">
    Sign in to the console with **email code** — enter your email, receive a 6-digit code, and sign in. Then open **API Keys** and create one; the secret is shown **once**. (Need an evaluation account? Email [Mirobody Support](mailto:developer@thetahealth.ai).)

    <Card title="Open the console → API Keys" icon="key" href="https://test-platform.mirobody.ai/developer/keys" horizontal>
      Sign in, create an `mb_live_*` key, and copy it.
    </Card>

    ```bash theme={null}
    export MIROBODY_API_KEY="mb_live_..."
    ```
  </Step>

  <Step title="Make your first call">
    <CodeGroup>
      ```bash curl theme={null}
      curl https://test-mirobody-api.thetahealth.ai/v1/chat/completions \
        -H "Authorization: Bearer $MIROBODY_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
              "model": "mirobody-flash",
              "messages": [{"role": "user", "content": "How is my fasting glucose trending?"}],
              "user": "alice"
            }'
      ```

      ```python Python (OpenAI SDK) theme={null}
      from openai import OpenAI

      client = OpenAI(api_key="$MIROBODY_API_KEY", base_url="https://test-mirobody-api.thetahealth.ai/v1")
      resp = client.chat.completions.create(
          model="mirobody-flash",
          messages=[{"role": "user", "content": "How is my fasting glucose trending?"}],
          user="alice",
      )
      print(resp.choices[0].message.content)
      ```

      ```javascript Node.js (OpenAI SDK) theme={null}
      import OpenAI from "openai";

      const client = new OpenAI({
        apiKey: process.env.MIROBODY_API_KEY,
        baseURL: "https://test-mirobody-api.thetahealth.ai/v1",
      });
      const resp = await client.chat.completions.create({
        model: "mirobody-flash",
        messages: [{ role: "user", content: "How is my fasting glucose trending?" }],
        user: "alice",
      });
      console.log(resp.choices[0].message.content);
      ```
    </CodeGroup>

    The `user` field isolates each end-user as a [Subject](/en/api-reference/overview#multi-tenancy-the-user-field) — pass each of your users' stable ids. See the full [Chat reference](/en/api-reference/chat).
  </Step>

  <Step title="Give the Subject some data">
    A fresh Subject has no data, so the agent will say so. Write a record (or upload a report with [`POST /v1/files`](/en/api-reference/files)) and ask again:

    ```bash theme={null}
    curl https://test-mirobody-api.thetahealth.ai/v1/data \
      -H "Authorization: Bearer $MIROBODY_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
            "user": "alice",
            "retention": "permanent",
            "records": [{"indicator": "fasting_glucose", "value": 5.4, "unit": "mmol/L", "time": "2026-06-16T07:30:00Z"}]
          }'
    ```

    `retention` is **required** on `POST /v1/data` (no default) — omitting it returns `400`. See [Data](/en/api-reference/data) and [Files](/en/api-reference/files).
  </Step>
</Steps>

## Prefer clicking over curl?

The console has a **Playground** — run chats, upload files, and inspect tool steps with no code.

<CardGroup cols={2}>
  <Card title="Playground" icon="flask" href="https://test-platform.mirobody.ai/developer">
    Try the agent in the browser against your account.
  </Card>

  <Card title="Usage" icon="chart-line" href="https://test-platform.mirobody.ai/developer/usage">
    Requests, tokens, and cost.
  </Card>
</CardGroup>

## See it live

<CardGroup cols={2}>
  <Card title="Mirobody app" icon="globe" href="https://test-chat.mirobody.ai/">
    **chat.mirobody.ai** — the flagship consumer product, the same engine behind this API.
  </Card>

  <Card title="Developer console" icon="terminal" href="https://test-platform.mirobody.ai/developer">
    Create `mb_live_*` keys, view usage, and try the Playground.
  </Card>
</CardGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/en/api-reference/overview">
    Auth, multi-tenancy, retention, and every `/v1` endpoint.
  </Card>

  <Card title="SDK Examples" icon="boxes-stacked" href="/en/api-reference/sdk-examples">
    curl / Python / Node, streaming and file upload.
  </Card>

  <Card title="China Region" icon="location-dot" href="/en/api-reference/regions/china">
    Base URLs, storage residency, models, and limits.
  </Card>

  <Card title="Compliance" icon="shield" href="/en/api-reference/compliance">
    PIPL / data residency; request a DPA.
  </Card>
</CardGroup>
