# GET /generation

Look up a generation of your Router space by id — its state, tokens, cost and attempts.

`GET /api/v1/generation?id=gen-…` (requires an API key)

Returns a generation of the key's Router space. The content of the request and answer is never returned here. A generation of another space is `404`.

## Response

```json
{
  "data": {
    "id": "gen-5d0c3b6e-…",
    "model": "google/gemma-3-4b-it",
    "requested_model": "openai/gpt-4o-mini",
    "created_at": "2026-10-28T09:34:12Z",
    "streamed": false,
    "cancelled": false,
    "state": "completed",
    "finish_reason": "stop",
    "usage_source": "upstream_cost",
    "total_cost": 0.0000146,
    "usage": 0.0000146,
    "tokens_prompt": 24,
    "tokens_completion": 14,
    "native_tokens_prompt": 24,
    "native_tokens_completion": 14,
    "native_tokens_reasoning": 0,
    "native_tokens_cached": 0,
    "provider_name": "global",
    "upstream_attempts": [
      { "attempt": 1, "provider": "global", "status": "failed", "billable": false, "http_status": 503 },
      { "attempt": 2, "provider": "global", "status": "succeeded", "billable": true, "http_status": 200 }
    ]
  }
}
```

| Field                                                                                                 |                                                                                                                                                                                                 |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model` / `requested_model`                                                                           | The model that answered / the model of the request.                                                                                                                                             |
| `state`                                                                                               | `running`, `completed`, `failed`, `cancelled` or `usage_unknown`.                                                                                                                               |
| `total_cost`, `usage`                                                                                 | The charge in PnP; `null` while the generation runs.                                                                                                                                            |
| `tokens_prompt`, `tokens_completion`                                                                  | Input and output tokens.                                                                                                                                                                        |
| `native_tokens_prompt`, `native_tokens_completion`, `native_tokens_reasoning`, `native_tokens_cached` | The same counted by the provider, plus reasoning and cached tokens.                                                                                                                             |
| `provider_name`                                                                                       | The region of the answering route: `global` or `ru`.                                                                                                                                            |
| `upstream_attempts`                                                                                   | Every attempt, with its region, status (`started`, `succeeded`, `partial`, `failed`, `cancelled`, `unknown`) and whether it was billed.                                                         |
| `usage_source`                                                                                        | Where the cost comes from: `upstream_cost` (the provider reported it), `generation_api`, `computed_usage` (tokens × prices) or `estimated` (no usage was reported, for example after a cancel). |

## Example

```bash
curl -s "https://router.nodul.ru/api/v1/generation?id=gen-5d0c3b6e-…" -H "Authorization: Bearer $NODUL_ROUTER_API_KEY"
```
