# OpenGrid documentation One API for video, image and audio models. You name a model; OpenGrid runs it on the lowest-priced healthy provider and moves the job if that provider fails. - [Quickstart](https://opengrid.one/docs/quickstart): A key, one request and a finished file. - [Create a generation](https://opengrid.one/docs/generations): Every field of the request and the reply. - [Use your agent](https://opengrid.one/docs/agents): The MCP server and the skill file for Claude Code, Codex and Cursor. ## Your first request The base URL is `https://api.opengrid.one/v1`. Requests and replies are JSON. A generation is a job: start it and wait on the same request for the result, or read it later by id. curl: ```sh curl "https://api.opengrid.one/v1/generations?wait=60" \ -H "Authorization: Bearer $OPENGRID_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }' ``` Python: ```python import os, uuid, requests api = "https://api.opengrid.one/v1" headers = {"Authorization": f"Bearer {os.environ['OPENGRID_API_KEY']}"} # Start the job and wait for it. You are charged only if it succeeds. job = requests.post( f"{api}/generations?wait=60", headers={**headers, "Idempotency-Key": str(uuid.uuid4())}, json={ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }, ).json() # A long video can outlast one request: keep waiting on the same job. while job["status"] in ("queued", "running"): job = requests.get(f"{api}/generations/{job['id']}?wait=60", headers=headers).json() print(job["status"], job["outputs"], job["charged_usd"]) ``` JavaScript: ```js const api = "https://api.opengrid.one/v1"; const headers = { Authorization: `Bearer ${process.env.OPENGRID_API_KEY}`, "Content-Type": "application/json", }; // Start the job and wait for it. You are charged only if it succeeds. let job = await fetch(`${api}/generations?wait=60`, { method: "POST", headers: { ...headers, "Idempotency-Key": crypto.randomUUID() }, body: JSON.stringify({ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }), }).then((r) => r.json()); // A long video can outlast one request: keep waiting on the same job. while (job.status === "queued" || job.status === "running") { job = await fetch(`${api}/generations/${job.id}?wait=60`, { headers }).then((r) => r.json()); } console.log(job.status, job.outputs?.[0]?.url, job.charged_usd); ``` ## Set up your agent Paste this into Claude Code, Codex, Cursor or any agent that can run commands. It reads the skill file, checks your key and is ready to generate. Paste this into your agent: ```text Set yourself up to use OpenGrid for any image, video, voice-over or music I ask for. Read https://opengrid.one/SKILL.md and follow its setup steps. My API key is in the OPENGRID_API_KEY environment variable; if it is not set, ask me for it and never print it. Tell me the price and wait for my yes before anything that spends credits. ``` To connect over MCP instead, see [MCP server](https://opengrid.one/docs/mcp). ## Endpoints at a glance | Endpoint | Key | What it does | |---|---|---| | `GET /v1/models` | No | Every model that can run now, with variants and prices. | | `GET /v1/models/{id}` | No | One model, with its quantity range and input fields. | | `GET /v1/status` | No | Success rate and typical time per model, last 24 hours. | | `POST /v1/estimate` | Yes | The price of a request. Charges nothing. | | `POST /v1/generations` | Yes | Start a generation. `?wait=60` holds the request until it finishes. | | `GET /v1/generations/{id}` | Yes | One generation. `?wait=60` holds the request until it finishes. | | `GET /v1/generations` | Yes | Recent generations, newest first. | | `GET /v1/balance` | Yes | Balance, account tier and limits. | | `GET /v1/usage` | Yes | Generations and spend per day. | ## For machines - [llms.txt](https://opengrid.one/llms.txt): every page of these docs with a one-line description. - [llms-full.txt](https://opengrid.one/llms-full.txt): all of the docs in one Markdown file. - [SKILL.md](https://opengrid.one/SKILL.md): the skill file an agent installs. - Every docs page has a Markdown copy: add `.md` to its address, or use **Copy page** at the top. Source: https://opengrid.one/docs --- # Quickstart From no account to a finished file in three steps. ## 1. Get a key and credits 1. [Sign in](https://opengrid.one/login) and open **API keys** in the dashboard. Create a key. It is shown once, so copy it now. 2. Open **Billing** and add credits. Credits are prepaid; there is no subscription. 3. Export the key in your terminal: Terminal: ```sh export OPENGRID_API_KEY=og_live_... ``` ## 2. Start a generation and wait for it `?wait=60` keeps the request open until the job finishes, so a short job comes back done in one call. You are charged only if it succeeds. curl: ```sh curl "https://api.opengrid.one/v1/generations?wait=60" \ -H "Authorization: Bearer $OPENGRID_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }' ``` Python: ```python import os, uuid, requests api = "https://api.opengrid.one/v1" headers = {"Authorization": f"Bearer {os.environ['OPENGRID_API_KEY']}"} # Start the job and wait for it. You are charged only if it succeeds. job = requests.post( f"{api}/generations?wait=60", headers={**headers, "Idempotency-Key": str(uuid.uuid4())}, json={ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }, ).json() # A long video can outlast one request: keep waiting on the same job. while job["status"] in ("queued", "running"): job = requests.get(f"{api}/generations/{job['id']}?wait=60", headers=headers).json() print(job["status"], job["outputs"], job["charged_usd"]) ``` JavaScript: ```js const api = "https://api.opengrid.one/v1"; const headers = { Authorization: `Bearer ${process.env.OPENGRID_API_KEY}`, "Content-Type": "application/json", }; // Start the job and wait for it. You are charged only if it succeeds. let job = await fetch(`${api}/generations?wait=60`, { method: "POST", headers: { ...headers, "Idempotency-Key": crypto.randomUUID() }, body: JSON.stringify({ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }), }).then((r) => r.json()); // A long video can outlast one request: keep waiting on the same job. while (job.status === "queued" || job.status === "running") { job = await fetch(`${api}/generations/${job.id}?wait=60`, { headers }).then((r) => r.json()); } console.log(job.status, job.outputs?.[0]?.url, job.charged_usd); ``` 200 OK: ```json { "id": "5b0e7c1e-6f0e-4a55-9d9b-3f2a8f1c2d10", "status": "succeeded", "charged_usd": 0.141225, "outputs": [ { "url": "https://api.opengrid.one/v1/generations/5b0e7c1e-.../content/0?exp=1795546991&sig=...", "mime": "image/png" } ], "error": null, "finished_at": "2026-11-24T18:03:34.009Z" } ``` A long video can outlast one request. The reply then has `status: "running"`, and you wait on the same job with `GET /v1/generations/{id}?wait=60`, as the Python and JavaScript samples do. ## 3. Download the file Each `outputs[].url` is a link signed for one hour. Download what you want to keep. Terminal: ```sh curl -L -o result.png "OUTPUT_URL" ``` ## Where to go next - [Models and variants](https://opengrid.one/docs/models): how to read the catalog and what a variant is. - [Estimate a price](https://opengrid.one/docs/estimate): the exact price before you spend. - [Routing and fallback](https://opengrid.one/docs/routing): which provider runs your job, and what happens when one fails. - [Use your agent](https://opengrid.one/docs/agents): hand the whole thing to Claude Code, Codex or Cursor. Source: https://opengrid.one/docs/quickstart --- # Models and variants The catalog is an endpoint. Read it to learn every model's id, prices and input fields. `GET /v1/models` lists every model that can run right now with its variants and prices. `GET /v1/models/{id}` adds the allowed quantity and every input field the model accepts. Neither needs a key. The same catalog is on the [Models](https://opengrid.one/models) page. GET /v1/models/nano-banana-pro: ```json { "id": "nano-banana-pro", "name": "Nano Banana Pro", "maker": "Google", "category": "image", "unit": "per_image", "variants": [ { "id": "1k", "label": "1K", "price_usd": 0.141225, "providers": 2 }, { "id": "2k", "label": "2K", "price_usd": 0.141225, "providers": 2 }, { "id": "4k", "label": "4K", "price_usd": 0.252105, "providers": 2 } ], "quantity": { "min": 1, "max": 4 }, "inputs": { "prompt": { "type": "text", "required": true, "max": 20000 }, "aspect_ratio": { "type": "enum", "required": false, "values": ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"] }, "images": { "type": "url_list", "required": false, "max": 14 } } } ``` ## How to read a model - A **variant** is a priced setting such as `720p` or `1080p+audio`. Its `price_usd` is per unit. `providers` is how many providers can run it. - The **unit** is what `quantity` counts: `per_second` (seconds of video), `per_image`, `per_run` (always 1) or `per_1k_chars`. - For `per_1k_chars` models, leave `quantity` out. It is worked out from the text: one unit per 1,000 characters, rounded up. - `inputs` is the complete list of fields the model takes in `input`. A field the model does not list is refused with a 400, never passed through. ## Input types | Type | What to send | |---|---| | `text` | A string, up to `max` characters. | | `enum` | One of `values`. | | `int` | A whole number between `min` and `max`. | | `bool` | `true` or `false`. | | `url` | A public `https` URL to a file. | | `url_list` | A list of public `https` URLs, up to `max`. | Files (`images`, `end_image`, `audio`, `video`) are always public `https` URLs. OpenGrid does not accept uploads or base64 data. Source: https://opengrid.one/docs/models --- # Estimate a price The exact price of a request before you spend anything. `POST /v1/estimate` takes the same body as a generation and charges nothing. It answers with the price the request starts at, the most it can cost, and whether your balance covers it. Request: ```sh curl "https://api.opengrid.one/v1/estimate" \ -H "Authorization: Bearer $OPENGRID_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }' ``` 200 OK: ```json { "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "unit": "per_image", "routing": "balanced", "fallback": true, "runnable": true, "price_usd": 0.141225, "max_price_usd": 0.1575, "providers": 2, "eta_seconds": 21.5, "currency": "USD", "balance_usd": 20, "affordable": true } ``` ## The reply | Field | Meaning | |---|---| | `price_usd` | What you pay if the first provider finishes the job. | | `max_price_usd` | What is held when the job starts, and the most you can be charged. It is above `price_usd` only when a fallback provider costs more. | | `runnable` | `false` comes with a `reason`: nothing can run the request as sent. | | `providers` | How many providers are in the plan for this request. | | `eta_seconds` | The typical time recent runs took on the first provider, or `null` when there is not enough history. | | `affordable` | Whether `balance_usd` covers `max_price_usd`. | Source: https://opengrid.one/docs/estimate --- # Create a generation One request starts the job and, with wait, returns the finished result. `POST /v1/generations` answers `202` with the job. Add `?wait=60` and the request stays open until the job finishes (up to 60 seconds), then answers `200` with the result. curl: ```sh curl "https://api.opengrid.one/v1/generations?wait=60" \ -H "Authorization: Bearer $OPENGRID_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }' ``` Python: ```python import os, uuid, requests api = "https://api.opengrid.one/v1" headers = {"Authorization": f"Bearer {os.environ['OPENGRID_API_KEY']}"} # Start the job and wait for it. You are charged only if it succeeds. job = requests.post( f"{api}/generations?wait=60", headers={**headers, "Idempotency-Key": str(uuid.uuid4())}, json={ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }, ).json() # A long video can outlast one request: keep waiting on the same job. while job["status"] in ("queued", "running"): job = requests.get(f"{api}/generations/{job['id']}?wait=60", headers=headers).json() print(job["status"], job["outputs"], job["charged_usd"]) ``` JavaScript: ```js const api = "https://api.opengrid.one/v1"; const headers = { Authorization: `Bearer ${process.env.OPENGRID_API_KEY}`, "Content-Type": "application/json", }; // Start the job and wait for it. You are charged only if it succeeds. let job = await fetch(`${api}/generations?wait=60`, { method: "POST", headers: { ...headers, "Idempotency-Key": crypto.randomUUID() }, body: JSON.stringify({ "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "input": { "prompt": "A paper boat drifting down a rain gutter, golden hour", "aspect_ratio": "16:9" } }), }).then((r) => r.json()); // A long video can outlast one request: keep waiting on the same job. while (job.status === "queued" || job.status === "running") { job = await fetch(`${api}/generations/${job.id}?wait=60`, { headers }).then((r) => r.json()); } console.log(job.status, job.outputs?.[0]?.url, job.charged_usd); ``` ## Body | Field | Required | Meaning | |---|---|---| | `model` | Yes | A model id from the catalog. | | `variant` | If more than one | A variant id such as `720p`. | | `quantity` | Depends on the unit | Seconds, images or runs, within the model's range. Leave out for `per_1k_chars`. | | `input` | Yes | The model's own fields, such as `prompt` and `aspect_ratio`. | | `routing` | No | `balanced` (default), `cheapest` or `fastest`. See [Routing](https://opengrid.one/docs/routing). | | `fallback` | No | Default `true`. `false` runs on one provider only and refunds on failure. | | `own_key_fallback` | No | Default `true`. If you have stored your own provider key in Settings, a job whose OpenGrid providers all fail runs on your key as a last resort, at no charge from OpenGrid. `false` turns that off for this request. With your own Higgsfield or World Labs key stored, `model` can also name one of their endpoints directly, as `higgsfield/` or `worldlabs/`: `input` is sent to the provider as written, and the run is on your key alone. | | `max_price_usd` | No | A cap. Providers that would cost more are never used. | ## Headers | Header | Required | Meaning | |---|---|---| | `Authorization` | Yes | `Bearer og_live_...` | | `Content-Type` | Yes | `application/json` | | `Idempotency-Key` | Recommended | 8 to 100 characters. Makes a retry safe. See [Idempotency](https://opengrid.one/docs/idempotency). | ## Query | Parameter | Meaning | |---|---| | `wait` | 0 to 60. Seconds to hold the request open while the job is unfinished. Default 0. | ## What happens when you submit 1. The request is priced on every provider that can take your exact input, and a plan of up to three providers is built. 2. `max_usd`, the highest price in that plan, is held from your balance. 3. The job runs on the first provider. If it fails, the job moves to the next. 4. On success you are charged the price of the provider that finished it, and the rest of the hold is returned. On failure the whole hold is returned. 202 Accepted: ```json { "id": "5b0e7c1e-6f0e-4a55-9d9b-3f2a8f1c2d10", "model": "nano-banana-pro", "variant": "2k", "quantity": 1, "unit": "per_image", "routing": "balanced", "status": "running", "charged_usd": 0.1575, "estimated_usd": 0.141225, "max_usd": 0.1575, "currency": "USD", "attempts": 1, "outputs": null, "available_until": null, "error": null, "created_at": "2026-11-24T18:03:11.412Z", "finished_at": null } ``` Source: https://opengrid.one/docs/generations --- # Get the result Wait on a job, read its outputs and download the files. `GET /v1/generations/{id}?wait=60` returns the job as soon as it finishes, or after 60 seconds if it is still `queued` or `running`; call it again to keep waiting. Without `wait` it answers at once with the current state. A job nobody is waiting on still finishes or is refunded on its own. Succeeded: ```json { "id": "5b0e7c1e-6f0e-4a55-9d9b-3f2a8f1c2d10", "status": "succeeded", "charged_usd": 0.141225, "outputs": [ { "url": "https://api.opengrid.one/v1/generations/5b0e7c1e-.../content/0?exp=1795546991&sig=...", "mime": "image/png" } ], "error": null, "finished_at": "2026-11-24T18:03:34.009Z" } ``` ## Statuses | status | Meaning | |---|---| | `queued` | Accepted, not yet started on a provider. | | `running` | A provider is working on it. | | `succeeded` | Finished. `outputs` has the result files and `charged_usd` is final. | | `failed` | Finished without a result. `error` says why and `charged_usd` is 0. | ## Result files - Each `outputs[].url` is an OpenGrid link signed for one hour. Reading the job again returns fresh links. Without the signature, the same path works with your API key. - Download results you want to keep. Providers delete their files after a retention period; when one reports the date, the job carries it as `available_until`. ## Why a generation failed | error.code | Meaning | |---|---| | `content_blocked` | The model's provider refused the prompt or files under its content policy. Not retried elsewhere. | | `invalid_input` | The model could not use the input as sent (size, format, a missing file). Not retried elsewhere. | | `provider_failed` | Every provider in the job's plan failed or timed out. | | `unavailable` | No provider could take the job when it started. | | `internal_error` | Something on our side stopped it. | ## List generations `GET /v1/generations` lists your recent jobs, newest first. `limit` goes up to 100; page with `before`. Source: https://opengrid.one/docs/results --- # Routing and fallback Which provider runs your job, and what happens when one fails. Several providers can run most models. For each request OpenGrid prices every provider that can take your exact input, checks its recent health and speed, and builds a plan of up to three providers. ## Routing modes | routing | Order | |---|---| | `balanced` | Healthy providers first, then the lowest price, then the quickest. The default. | | `cheapest` | Lowest price first, whatever its recent health. A pricier provider runs only after the cheaper ones fail. | | `fastest` | Quickest measured provider first, except one that is down. It can cost more. | ## Health Health is the success rate over the last ten minutes, for the provider overall and for the model on that provider: under 95% is degraded, under 80% is down. Failures caused by a request's own input do not count against a provider. ## Fallback Fallback moves a job to the next provider when one fails or does not finish within 15 minutes. By default a fallback provider is used only if it costs at most 50% more than the first; set `max_price_usd` to choose your own cap, or `fallback: false` for exactly one provider. A request the model's provider refuses for its content or input is never sent to another provider. Source: https://opengrid.one/docs/routing --- # Idempotency Make every retry safe. Send an `Idempotency-Key` header (8 to 100 characters; a UUID is ideal) on `POST /v1/generations`. Repeating the request with the same key returns the job it already created and never charges twice, so a timeout is always safe to retry. Using the same key for a different request answers `409 idempotency_conflict`. Source: https://opengrid.one/docs/idempotency --- # Authentication API keys, where to send them and how to limit them. Send your key as a bearer token on every request except the model list and status: `Authorization: Bearer og_live_...`. - A key is shown once when you create it and stored only as a hash, so keep it somewhere safe. - Use it from a server, never in a web page or an app binary. - You can have up to 10 active keys and revoke any of them at any time. - Each key can carry its own spend limit. Give an agent a key with a limit and that is the most it can use. A missing, wrong or revoked key answers `401 unauthorized`. Source: https://opengrid.one/docs/authentication --- # How charging works Prepaid credits, a hold when a job starts, and nothing for a run that fails. - When a job is accepted, `max_usd` is held from your balance. While the job is open, `charged_usd` shows that hold. - When it succeeds, `charged_usd` becomes the price of the provider that finished it and the rest of the hold is returned in the same moment. - When it fails, the whole hold is returned. - A few models are billed on what the run really used (for example speech billed by the second of audio). They hold a ceiling and settle lower. ## Credits Credits are prepaid in US dollars and there is no subscription. A service fee is added when you buy them. The current minimum, the fee and every model's price are on the [Pricing](https://opengrid.one/pricing) page. Source: https://opengrid.one/docs/billing --- # Limits Request rates and sizes. - 300 API requests per minute per key. - Generations in progress at once, and new generations per minute, depend on your account tier. `GET /v1/balance` returns your current limits. - Request bodies are limited to 64 KB. - A refused request is never charged. Need higher limits? Write to [support@opengrid.one](mailto:support@opengrid.one). Source: https://opengrid.one/docs/limits --- # Balance and usage Read your balance, spend and the health of each model. | Endpoint | What it returns | |---|---| | `GET /v1/balance` | Your balance, account tier and limits. | | `GET /v1/usage?days=30` | Generations and spend per day, up to 366 days. | | `GET /v1/status` | Success rate and typical time per model over the last 24 hours. No key needed. | Source: https://opengrid.one/docs/account --- # Use your agent Give Claude Code, Codex, Cursor or any agent your key and it can find a model, price a job and run it. ## The quick way Paste this into your agent. It reads the skill file, checks your key and is ready. Paste this into your agent: ```text Set yourself up to use OpenGrid for any image, video, voice-over or music I ask for. Read https://opengrid.one/SKILL.md and follow its setup steps. My API key is in the OPENGRID_API_KEY environment variable; if it is not set, ask me for it and never print it. Tell me the price and wait for my yes before anything that spends credits. ``` ## Two ways to connect | | Skill file | MCP server | |---|---|---| | What it is | A Markdown file that teaches the agent to call the REST API. | The API as tools the agent calls directly. | | Works in | Any agent that can run shell commands. | Hosts that accept an MCP server with an `Authorization` header. | | Set up | Paste the prompt above, or save [SKILL.md](https://opengrid.one/SKILL.md). | One command. See [MCP server](https://opengrid.one/docs/mcp). | They do the same thing and you can use both. Details: [Skill file](https://opengrid.one/docs/skill) and [MCP server](https://opengrid.one/docs/mcp). ## Before you hand over a key - Create a separate key for the agent on the API keys page and give it a spend limit. That limit is the most the agent can use. - Set the key in your own terminal as `OPENGRID_API_KEY`. Do not type it into the chat. - The skill and the MCP server both tell the agent to show you the price and wait for your yes before it spends. - A failed generation costs nothing, whoever started it. ## Try it Prompt: ```text Use OpenGrid to make a 5 second video of a paper boat in a rain gutter for under $1.50. ``` Source: https://opengrid.one/docs/agents --- # MCP server The OpenGrid API as MCP tools, at one address. The server is at `https://api.opengrid.one/mcp` (Streamable HTTP). It authenticates with your API key in the `Authorization` header, so a key's spend limit caps what the agent can use. ## Add the server Export your key first (`export OPENGRID_API_KEY=og_live_...`), then run the command for your host. Claude Code: ```sh claude mcp add --transport http opengrid https://api.opengrid.one/mcp \ --header "Authorization: Bearer $OPENGRID_API_KEY" ``` Codex: ```sh codex mcp add opengrid --url https://api.opengrid.one/mcp \ --bearer-token-env-var OPENGRID_API_KEY ``` Cursor and others: ```json { "mcpServers": { "opengrid": { "url": "https://api.opengrid.one/mcp", "headers": { "Authorization": "Bearer og_live_..." } } } } ``` For Cursor, the JSON goes in `~/.cursor/mcp.json`. Other hosts take the same shape in their own MCP config. ## Tools | Tool | What it does | |---|---| | `list_models` | Models that can run now, with starting prices. Filter by category or a search word. | | `get_model` | One model's variants, prices, quantity limits and input fields. | | `estimate` | The exact price of a request and the most it can cost. Charges nothing. | | `generate` | Starts a generation and waits up to 50 seconds for the result. | | `get_generation` | A generation's status, charge and result links. Waits for an unfinished one. | | `list_generations` | Your most recent generations. | | `get_balance` | Your credit balance and limits. | ## How it behaves - The server tells the agent to price a job and get your agreement before it spends. - `generate` waits up to 50 seconds. A longer job comes back still running, and the agent calls `get_generation` to keep waiting. - Every tool is the same call as the REST API with your key, so prices, limits and refunds are identical. - Result links are signed for one hour. Ask the agent to save a file you want to keep. > Hosts that only connect through OAuth sign-in, such as custom connectors in the Claude and ChatGPT apps, are not supported yet. Use the [skill file](https://opengrid.one/docs/skill) there if the host can run commands. Source: https://opengrid.one/docs/mcp --- # Skill file One Markdown file that teaches any agent to use OpenGrid. [SKILL.md](https://opengrid.one/SKILL.md) holds the setup steps, the rules for spending, the request flow with working commands, and what to do on each error. An agent that has read it needs no other page. ## Install it The fastest way is to let the agent do it. Paste this: Paste this into your agent: ```text Set yourself up to use OpenGrid for any image, video, voice-over or music I ask for. Read https://opengrid.one/SKILL.md and follow its setup steps. My API key is in the OPENGRID_API_KEY environment variable; if it is not set, ask me for it and never print it. Tell me the price and wait for my yes before anything that spends credits. ``` Or save the file yourself: Claude Code, every project: ```sh mkdir -p ~/.claude/skills/opengrid curl -fsSL https://opengrid.one/SKILL.md -o ~/.claude/skills/opengrid/SKILL.md ``` Claude Code, this project: ```sh mkdir -p .claude/skills/opengrid curl -fsSL https://opengrid.one/SKILL.md -o .claude/skills/opengrid/SKILL.md ``` Any agent, AGENTS.md: ```sh curl -fsSL https://opengrid.one/SKILL.md >> AGENTS.md ``` Other agents: save the file wherever yours reads skills, or add its contents to the instructions file it loads. ## Set your key Terminal: ```sh export OPENGRID_API_KEY=og_live_... ``` The skill reads the key from that variable and is told never to print it. ### What the agent will do 1. Check the key with `GET /v1/balance`. 2. Find a model and read its input fields. 3. Estimate the price and ask you. 4. Start the generation, wait for it and download the file. Source: https://opengrid.one/docs/skill --- # Errors One shape for every error, and what to do about each. Every error has the same shape. The message is written to be shown to a person. 402: ```json { "error": { "code": "insufficient_credits", "message": "Not enough credits for this request. Add credits and try again." } } ``` | Status | Codes | What to do | |---|---|---| | 400 | `invalid_request` | The body is malformed or the model does not accept an input. The message says what to change. | | 401 | `unauthorized` | The API key is missing, wrong or revoked. | | 402 | `insufficient_credits`, `key_spend_limit` | The balance, or this key's spend limit, does not cover the request. | | 403 | `account_frozen`, `forbidden` | The account is on hold, or the endpoint is dashboard-only. | | 404 | `unknown_model`, `not_found` | No such model, generation or route. | | 409 | `unavailable`, `price_above_max`, `idempotency_conflict` | No provider can run the request (or none under your price cap), or the Idempotency-Key was used for a different request. | | 413 / 415 | `too_large`, `unsupported_media_type` | The body is over 64 KB or is not JSON. | | 429 | `rate_limited`, `too_many_in_progress`, `too_many_per_minute` | Slow down, or wait for a running job to finish. | | 500 / 503 | `internal_error`, `generation_disabled` | Our side. Retry with the same Idempotency-Key. | A generation that was accepted and then failed is not an HTTP error: it is a job with `status: "failed"`. See [Why a generation failed](https://opengrid.one/docs/results#failed). Source: https://opengrid.one/docs/errors --- # API reference Every endpoint on one page. Base URL: `https://api.opengrid.one/v1`. Send `Authorization: Bearer og_live_...` where a key is needed. | Endpoint | Key | What it does | |---|---|---| | `GET /v1/models` | No | Every model that can run now, with variants and prices. | | `GET /v1/models/{id}` | No | One model, with its quantity range and input fields. | | `GET /v1/status` | No | Success rate and typical time per model, last 24 hours. | | `POST /v1/estimate` | Yes | The price of a request. Charges nothing. | | `POST /v1/generations` | Yes | Start a generation. `?wait=60` holds the request until it finishes. | | `GET /v1/generations/{id}` | Yes | One generation. `?wait=60` holds the request until it finishes. | | `GET /v1/generations` | Yes | Recent generations, newest first. | | `GET /v1/balance` | Yes | Balance, account tier and limits. | | `GET /v1/usage` | Yes | Generations and spend per day. | ## The generation object | Field | Meaning | |---|---| | `id` | The job's id. | | `model`, `variant`, `quantity`, `unit` | What was asked for. | | `prompt` | The prompt from the request's input, or `null` when it had none. | | `routing` | The routing mode the job was planned with. | | `status` | `queued`, `running`, `succeeded` or `failed`. | | `estimated_usd` | The price on the first provider in the plan. | | `max_usd` | The amount held when the job started. | | `charged_usd` | The hold while the job is open; the final charge once it is finished. | | `attempts` | How many providers have been tried. | | `outputs` | A list of `{ url, mime }` once the job has succeeded. | | `available_until` | When the provider deletes the result, if it reports a date. | | `error` | `{ code, message }` on a failed job. | | `created_at`, `finished_at` | ISO 8601 times. | Models change often, so they are not listed here. Read them from `GET /v1/models` or browse the [Models](https://opengrid.one/models) page; each model page has a request you can copy. Source: https://opengrid.one/docs/reference