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

# Quickstart

> Make your first MESH request in two minutes.

You need a `mesh_live_...` API key. Sign in at [meshrouter.app](https://meshrouter.app/portal) to
create one, or [email us](mailto:onboarding@meshrouter.app?subject=MESH%20access) to request access.

Prefer a browser? Open [MESH chat](https://meshrouter.app/chat) to talk to any model without an API
key.

## 1. Set your environment

```bash theme={null}
export MESH_API_KEY=mesh_live_...
export OPENAI_BASE_URL=https://api.meshrouter.app/v1
export OPENAI_API_KEY=$MESH_API_KEY
```

## 2. Send a request

<CodeGroup>
  ```ts TypeScript theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    baseURL: process.env.OPENAI_BASE_URL,
    apiKey: process.env.OPENAI_API_KEY,
  });

  const completion = await client.chat.completions.create({
    model: 'auto',
    messages: [{ role: 'user', content: 'Hello MESH' }],
  });

  console.log(completion.choices[0]?.message?.content);
  ```

  ```python Python theme={null}
  from openai import OpenAI
  import os

  client = OpenAI(
      base_url=os.environ["OPENAI_BASE_URL"],
      api_key=os.environ["OPENAI_API_KEY"],
  )

  completion = client.chat.completions.create(
      model="auto",
      messages=[{"role": "user", "content": "Hello MESH"}],
  )

  print(completion.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl https://api.meshrouter.app/v1/chat/completions \
    -H "Authorization: Bearer $MESH_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model":"auto","messages":[{"role":"user","content":"Hello MESH"}]}'
  ```
</CodeGroup>

`model: "auto"` lets MESH pick a model for you. To pin a specific one, pass its MESH id (e.g.
`"mesh/claude-sonnet-4.5"`, `"mesh/balanced"`, `"mesh/deepseek-r1"`). See [Models](/models) for the
full catalogue and [Routing](/routing) for fallback chains.

## 3. Read the receipt

Every routed call returns these headers:

| Header                     | Meaning                              |
| -------------------------- | ------------------------------------ |
| `x-mesh-upstream-cost-usd` | What the provider charged            |
| `x-mesh-margin-usd`        | MESH margin on the call              |
| `x-mesh-total-usd`         | Total drawn from your balance        |
| `x-mesh-receipt-id`        | ID for lookup via `/v1/receipts/:id` |

## What's next

* [Streaming, tools, vision, and structured output](/tool-calling) work identically to OpenAI.
* [Privacy mode](/privacy/mesh) routes through MESH privacy with signed attestation.
* [USDC payments](/payments) — top up via Base or Solana.
