# 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
