---
name: opengrid
description: Generate video, images and audio through the OpenGrid API. Use when the user asks to make, edit or price an image, a video, a voice-over, music or a sound effect, or names a model such as Seedance, Veo, Kling, Wan, Nano Banana, Seedream, Flux or GPT Image. OpenGrid runs each model on the lowest-priced healthy provider and refunds a run that fails.
---

# OpenGrid

One API for video, image and audio models. You name a model; OpenGrid picks the provider, moves the job to another one if it fails, and charges only for a run that succeeds.

- API: https://api.opengrid.one/v1
- MCP server (Streamable HTTP): https://api.opengrid.one/mcp
- Docs: https://opengrid.one/docs (every page has a Markdown copy, listed in https://opengrid.one/llms.txt)

## Set yourself up

1. Check that `OPENGRID_API_KEY` is set in the environment. If it is not, ask the user for a key from https://opengrid.one/dashboard/keys and have them export it in their own terminal. Never print the key, write it to a file or put it in a URL.
2. Confirm it works: `curl -s https://api.opengrid.one/v1/balance -H "Authorization: Bearer $OPENGRID_API_KEY"`. A 401 means the key is wrong or revoked.
3. If your host supports MCP servers with a custom header, add the server once and use its tools (`list_models`, `get_model`, `estimate`, `generate`, `get_generation`, `list_generations`, `get_balance`). Otherwise call the REST API directly as shown below. Both do the same thing.

```sh
# Claude Code
claude mcp add --transport http opengrid https://api.opengrid.one/mcp \
  --header "Authorization: Bearer $OPENGRID_API_KEY"

# Codex
codex mcp add opengrid --url https://api.opengrid.one/mcp \
  --bearer-token-env-var OPENGRID_API_KEY
```

To keep this skill for later sessions, save this file as `~/.claude/skills/opengrid/SKILL.md` (Claude Code) or wherever your agent reads skills.

## Rules

- Price before you spend. Call estimate, tell the user the price, and wait for a yes. Then generate with `max_price_usd` set to what they agreed.
- Send an `Idempotency-Key` header (a UUID) on every generation. Repeating a request with the same key never charges twice, so a timeout is safe to retry.
- Do not guess model ids, variants or input fields. Read them from the API; a field the model does not list is refused with a 400.
- Files you pass in (`images`, `end_image`, `audio`, `video`) must be public https URLs.
- Result links expire after one hour. Download a file the user wants to keep.
- Use the API directly. Do not build an app or a website to make one image.

## Make something

1. Find a model. No key needed.

```sh
curl -s https://api.opengrid.one/v1/models
```

Each model has an `id`, a `category` (`video`, `image`, `audio`), a `unit`, and `variants` with a `price_usd` per unit. If the user named a model, use it. Otherwise pick by category and price and say which one you picked.

2. Read its inputs.

```sh
curl -s https://api.opengrid.one/v1/models/seedance-2.5
```

`inputs` lists every field the model accepts and which are required. `quantity` gives the allowed range: seconds for `per_second`, images for `per_image`, always 1 for `per_run`. For `per_1k_chars` leave quantity out; it is worked out from the text.

3. Get the price. This charges nothing.

```sh
curl -s https://api.opengrid.one/v1/estimate \
  -H "Authorization: Bearer $OPENGRID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2.5","variant":"720p","quantity":5,"input":{"prompt":"A paper boat drifting down a rain gutter, golden hour"}}'
```

`price_usd` is what the request costs if the first provider finishes it. `max_price_usd` is the most it can cost. `runnable: false` comes with a `reason`. `affordable: false` means the balance is too low: point the user to https://opengrid.one/dashboard/billing.

4. After the user agrees, start the job and wait for it.

```sh
curl -s "https://api.opengrid.one/v1/generations?wait=60" \
  -H "Authorization: Bearer $OPENGRID_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"model":"seedance-2.5","variant":"720p","quantity":5,"max_price_usd":1.30,"input":{"prompt":"A paper boat drifting down a rain gutter, golden hour"}}'
```

`?wait=60` holds the request open until the job finishes, up to 60 seconds.

5. If `status` is still `queued` or `running`, keep waiting on the same job. A long video can take several minutes.

```sh
curl -s "https://api.opengrid.one/v1/generations/JOB_ID?wait=60" -H "Authorization: Bearer $OPENGRID_API_KEY"
```

6. When `status` is `succeeded`, each `outputs[].url` is a signed link to a result file. Download it with `curl -L -o result.mp4 "URL"` and tell the user what was charged (`charged_usd`). When `status` is `failed`, `error.message` says why and `charged_usd` is 0.

## Request fields

| Field | Meaning |
|---|---|
| `model` | Required. A model id from the catalog. |
| `variant` | A variant id such as `720p`. Required when the model has more than one. |
| `quantity` | Seconds, images or runs, within the model's range. |
| `input` | The model's own fields, such as `prompt` and `aspect_ratio`. |
| `routing` | `balanced` (default), `cheapest` or `fastest`. |
| `fallback` | Default true. `false` runs on one provider only. |
| `max_price_usd` | The most this job may cost. Providers that would cost more are never used. |

## When something goes wrong

| Status | Code | What to do |
|---|---|---|
| 400 | `invalid_request` | Fix the body. The message says which field. |
| 401 | `unauthorized` | The key is missing, wrong or revoked. Ask the user. |
| 402 | `insufficient_credits`, `key_spend_limit` | Tell the user. Credits are added at https://opengrid.one/dashboard/billing. |
| 404 | `unknown_model` | Read the model list again. |
| 409 | `unavailable`, `price_above_max` | No provider can run it now, or none under the cap. Try another variant or model, or ask the user to raise the cap. |
| 429 | `rate_limited`, `too_many_in_progress` | Wait for a running job to finish, then retry. |
| 500, 503 | `internal_error` | Retry with the same Idempotency-Key. |

A failed job with `error.code` `content_blocked` or `invalid_input` will fail the same way again: change the prompt or the files before retrying.

## Other endpoints

- `GET https://api.opengrid.one/v1/generations`: recent jobs, newest first.
- `GET https://api.opengrid.one/v1/balance`: balance, account tier and limits.
- `GET https://api.opengrid.one/v1/usage?days=30`: generations and spend per day.
- `GET https://api.opengrid.one/v1/status`: success rate and typical time per model over the last 24 hours. No key needed.
