> For the list of every page, fetch /llms.txt. The API contract is the OpenAPI file linked from the API reference.

# Quickstart

Make your first model call with your own provider key. Then, if you need a sandbox, create one, run a command, and delete it.

For the model call, you need:

- The base URL and admin key you received when you joined the beta.
- A Google Gemini API key.
- curl.

The optional sandbox example uses a Daytona API key. The Python example runs both workflows and needs Python 3.9 or newer and the `requests` package.

Samples shorten IDs to eight characters after the prefix. Real IDs are longer.

<a id="1-set-your-key"></a>

## 1. Set your Meadow API key

```bash
export MEADOW_BASE_URL="https://api.usemeadow.ai"
export MEADOW_API_KEY="mdw_..."
```

Your account starts with one project, and your admin key belongs to it.

<a id="2-store-your-vendor-keys"></a>

## 2. Store a model provider key

Store the Gemini API key Meadow will use for the model call.

```bash
export GOOGLE_API_KEY="<your Gemini API key>"

curl -sS -X PUT "$MEADOW_BASE_URL/v1/provider-keys/google" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"credentials": {"api_key": "'"$GOOGLE_API_KEY"'"}}'
```

```json
{"created_at":"2026-11-24T20:27:02.937Z","last4":"a1B2","project_ids":null,"provider":"google","verified_at":"2026-11-24T20:35:20.314Z"}
```

Meadow checks the key with the provider before saving it, encrypts it, and never returns it. `last4` identifies the stored key.

Other providers require different credential fields. See [Provider keys](/set-up-your-account/provider-keys#credentials-for-each-provider).

## 3. Make a model call

Send the request in the OpenAI Chat Completions format, with your Meadow API key:

```bash
curl -sS "$MEADOW_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-lite-preview",
    "messages": [{"role": "user", "content": "Say hello in five words."}],
    "max_tokens": 32
  }'
```

```json
{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Hello there, how are you?","extra_content":{"google":{"thought_signature":"EqkBCqYB..."}},"role":"assistant"}}],"created":1795552521,"id":"CPUFa7Kd...","model":"gemini-3.1-flash-lite-preview","object":"chat.completion","usage":{"completion_tokens":7,"prompt_tokens":7,"total_tokens":14}}
```

The response body is the provider's, unchanged. Three response headers say who served it. Add `-i` to see them:

```text
x-meadow-attempts: 1
x-meadow-model: gemini-3.1-flash-lite-preview
x-meadow-provider: google
```

Meadow also takes the OpenAI Responses and Anthropic Messages formats. See [Models](/call-models/models). To point an OpenAI or Anthropic SDK at Meadow, see [Use your existing tools](/call-models/use-your-existing-tools).

<a id="4-run-a-command-in-a-sandbox"></a>

## 4. Run a command in a sandbox (optional)

You need a stored sandbox provider key for this example. Store your Daytona API key:

```bash
export DAYTONA_API_KEY="<your Daytona API key>"

curl -sS -X PUT "$MEADOW_BASE_URL/v1/provider-keys/daytona" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"credentials": {"api_key": "'"$DAYTONA_API_KEY"'"}}'
```

```json
{"created_at":"2026-11-24T20:34:43.030Z","last4":"c3D4","project_ids":null,"provider":"daytona","verified_at":"2026-11-24T20:35:20.596Z"}
```

This response was captured before 2026-11-28. Since then, the `daytona` response also carries `sandbox_health`, which reports whether recent sandbox creates failed. See [Provider keys](/set-up-your-account/provider-keys).

Create a sandbox and wait for it to run:

```bash
curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes?wait=true" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "python:3.12-slim", "timeout_seconds": 600}'
```

```json
{
  "attempts": [{"duration_ms": 1425, "outcome": "served", "provider": "daytona"}],
  "created_at": "2026-11-24T20:35:42.556Z",
  "expires_at": "2026-11-24T20:45:44.154Z",
  "failure_reason": null,
  "id": "sbx_00001f4e",
  "labels": {},
  "name": null,
  "network": {"allow_cidrs": [], "allow_domains": [], "block_all": false},
  "ports": [],
  "project_id": "prj_0000223e",
  "provider": "daytona",
  "provider_sandbox_id": "0000e093",
  "resources": {"cpu": 2, "memory_mb": 4096},
  "ssh": false,
  "started_at": "2026-11-24T20:35:44.154Z",
  "status": "running",
  "terminated_at": null
}
```

This response was captured on 2026-11-24, before each attempt carried `reason`, `started_at` and `finished_at`, which it does now. `GET /v1/sandboxes/{sandbox_id}` also returns a `cost` object: see [Usage and cost](/call-models/usage-and-cost#the-cost-of-one-sandbox).

The same create, the command and the delete were run again on the hosted beta on 2026-11-28, served by Modal: 202 with `running`, exit code 0 with `Python 3.12.15`, then 202 on the delete and 409 `sandbox is not running` for a command sent after it.

Read `status`. The call answers 202 whether the sandbox is `running` or `failed`. A `failed` sandbox says why in `failure_reason` and `attempts`. The usual cause is a misspelled image name.

Run a command, using the `id` from the response:

```bash
export SANDBOX="sbx_..."

curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes/$SANDBOX/exec" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command": "python --version && echo hello from the sandbox"}'
```

```json
{"exit_code":0,"stderr":"","stdout":"Python 3.12.16\nhello from the sandbox\n","timed_out":false}
```

Delete the sandbox when you are done. It runs in your provider account and the provider bills you for it. `timeout_seconds` ends it after ten minutes if you forget.

```bash
curl -sS -X DELETE "$MEADOW_BASE_URL/v1/sandboxes/$SANDBOX" \
  -H "Authorization: Bearer $MEADOW_API_KEY" -w '%{http_code}\n'
```

```text
204
```

A command sent to a sandbox that is not running returns a 409:

```json
{"error":{"code":"conflict","message":"sandbox is not running","type":"conflict"},"request_id":"req_0000903c"}
```

Every error body carries a `request_id`. Send it to support when you report a failed call.

If you stored no key for a sandbox provider, the create returns a 422 with the type `no_provider_key` and the message `no usable sandbox provider key stored for allowed providers`. Fix: store a `daytona` or `modal` key as shown at the start of this step.

<a id="5-mint-a-key-for-your-code"></a>

## 5. Create a key for your code

The admin key manages your whole account. Keep it out of your application. Create a key that holds only the scopes the application needs. List your projects and copy the project ID for the application key:

```bash
curl -sS "$MEADOW_BASE_URL/v1/projects" \
  -H "Authorization: Bearer $MEADOW_API_KEY"
```

```json
{"data":[{"created_at":"2026-11-23T22:07:05.170Z","id":"prj_0000223e","max_sandboxes":null,"name":"default","webhook_url":null}],"has_more":false,"object":"list"}
```

```bash
export PROJECT_ID="prj_..."

curl -sS -X POST "$MEADOW_BASE_URL/v1/keys" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"project_id": "'"$PROJECT_ID"'", "name": "my-app", "scopes": ["models"]}'
```

```json
{"created_at":"2026-11-28T07:48:21.842Z","disabled":false,"expires_at":null,"id":"key_0000f1f0","last4":"e5F6","last_used_at":null,"limit":null,"limit_action":null,"limit_remaining":null,"limit_reset":null,"limit_reset_at":null,"max_requests":null,"max_sandboxes":null,"max_tokens":null,"name":"my-app","parent_key_id":"key_0000b694","project_id":"prj_0000223e","requests_remaining":null,"requests_used":0,"revoked_at":null,"scopes":["models"],"secret":"mdw_...","tokens_remaining":null,"tokens_used":0,"usage":null}
```

`secret` is shown once. Store it now.

A key works only on the routes its scopes cover. This key has `models`, so a sandbox call with it returns a 403:

```bash
export APP_KEY="mdw_..."

curl -sS "$MEADOW_BASE_URL/v1/sandboxes" \
  -H "Authorization: Bearer $APP_KEY"
```

```json
{"error":{"code":"scope_missing","message":"key does not have sandboxes scope","type":"forbidden"},"request_id":"req_0000ff69"}
```

Fix: create a key with `"scopes": ["models", "sandboxes"]`, or use a key that has the scope. A key's scopes cannot be changed after it is created. [Authentication](/set-up-your-account/authentication#scopes) lists the routes each scope covers.

## The same steps in Python

This script stores both provider keys, makes the model call, and runs the sandbox example. Set all four environment variables shown above before running it.

```python
import os
import requests

BASE = os.environ["MEADOW_BASE_URL"]
HEADERS = {"Authorization": f"Bearer {os.environ['MEADOW_API_KEY']}"}


def call(method, path, **kwargs):
    resp = requests.request(method, f"{BASE}{path}", headers=HEADERS, timeout=330, **kwargs)
    if not resp.ok:
        raise SystemExit(f"{method} {path}: {resp.status_code} {resp.text}")
    return resp


# Step 2: store your vendor keys.
for provider, variable in [("google", "GOOGLE_API_KEY"), ("daytona", "DAYTONA_API_KEY")]:
    stored = call("PUT", f"/v1/provider-keys/{provider}", json={"credentials": {"api_key": os.environ[variable]}})
    print("stored", stored.json()["provider"])

# Step 3: make a model call.
reply = call(
    "POST",
    "/v1/chat/completions",
    json={
        "model": "gemini-3.1-flash-lite-preview",
        "messages": [{"role": "user", "content": "Say hello in five words."}],
        "max_tokens": 32,
    },
)
print(reply.json()["choices"][0]["message"]["content"])
print("served by", reply.headers["x-meadow-provider"], "in", reply.headers["x-meadow-attempts"], "attempt(s)")

# Step 4: create a sandbox, run a command, delete the sandbox.
sandbox = call(
    "POST",
    "/v1/sandboxes",
    params={"wait": "true"},
    json={"image": "python:3.12-slim", "timeout_seconds": 600},
).json()
try:
    if sandbox["status"] != "running":
        raise SystemExit(f"sandbox is {sandbox['status']}: {sandbox['failure_reason']} {sandbox['attempts']}")
    print("sandbox running on", sandbox["provider"])
    result = call(
        "POST",
        f"/v1/sandboxes/{sandbox['id']}/exec",
        json={"command": "python --version && echo hello from the sandbox"},
    ).json()
    print(result["exit_code"], result["stdout"], end="")
finally:
    deleted = call("DELETE", f"/v1/sandboxes/{sandbox['id']}")
    print("delete returned", deleted.status_code)
```

```text
stored google
stored daytona
Hello, it is nice meeting.
served by google in 1 attempt(s)
sandbox running on daytona
0 Python 3.12.16
hello from the sandbox
delete returned 204
```

On any error the script stops and prints the status and the error body. A delete can also return 202 when the provider is slow. Both mean the sandbox is ending.

## If a step fails

### Authentication

If the key is missing you get a 401:

```json
{"error":{"code":"api_key_missing","message":"missing api key","type":"unauthorized"},"request_id":"req_0000c7e0"}
```

Fix: check that `MEADOW_API_KEY` is set in this shell. A mistyped key returns `invalid api key`. [Authentication](/set-up-your-account/authentication#what-a-bad-key-looks-like) lists every case.

### Missing model provider key

If no stored key can serve the model, for example because you skipped step 2, you get a 422:

```json
{"error":{"message":"no stored provider key can serve this request","type":"invalid_request_error","param":null,"code":"no_provider_key"},"request_id":"req_0000c5d0"}
```

Fix: store a key for a provider that serves the model, then send the call again. `GET /v1/models` lists the model IDs your stored keys can reach. With no stored keys the list is empty.

### Other errors

| Status | Message | Cause | Fix |
| --- | --- | --- | --- |
| 401 | `missing api key` or `invalid api key` | The key was not sent, or is wrong. | Step 1. |
| 400 | `provider credential verification failed` | The provider rejected the key you tried to store. | Check the provider key. Nothing was saved. |
| 422 | `no stored provider key can serve this request` | No stored key reaches a provider that serves the model. | Step 2. |
| 404 | `unknown model` | The model ID is not one Meadow lists. | Use an ID from `GET /v1/models`, or pin the provider: `google/<model>`. |
| 422 | `no usable sandbox provider key stored for allowed providers` | No `daytona` or `modal` key is stored. | Step 4. |
| 403 | `key does not have sandboxes scope` | The key lacks the scope for the route. | Step 5. |
| 409 | `sandbox is not running` | The sandbox ended, failed, or is still being created. | Read its `status`. Create a new one. |

[Errors](/reference/errors) explains every error type and when a retry is safe.

## Next

- [Concepts](/get-started/concepts): accounts, projects, keys, and how a request is routed.
- [Routing and fallbacks](/call-models/routing-and-fallbacks): store a second provider key and let Meadow fall back.
- [Running commands](/run-sandboxes/running-commands): streamed output and long background commands.
- [Known limits](/reference/known-limits): read this before you build on the beta.
- [API reference](/reference/api-reference): every operation.

Operations used on this page: [`listProjects`](/reference/api-reference#listprojects), [`putProviderKey`](/reference/api-reference#putproviderkey), [`createChatCompletion`](/reference/api-reference#createchatcompletion), [`createSandbox`](/reference/api-reference#createsandbox), [`execInSandbox`](/reference/api-reference#execinsandbox), [`deleteSandbox`](/reference/api-reference#deletesandbox), [`createKey`](/reference/api-reference#createkey), [`listSandboxes`](/reference/api-reference#listsandboxes).