# Get a generation

Every call through Gateway is recorded under the id its answer carried. Read the record back to see who served it, every provider tried in order, the tokens, and what each attempt cost.

`GET https://api.momor.ai/models/requests/{requestId}`

## Path

- `requestId` (string, required): The id the call’s answer carried in X-Momor-Request-Id, which is also the id of a Chat Completions answer.

## Headers

- `Authorization` (string, required): Bearer and an API key of the organization that made the call.

## Response

A record holds metadata alone: nothing a call sent or was answered with is kept. A field with no value is left out, and the record also carries its own `id`, `tenantId` and `createdBy`.

- `requestId` (string): The call’s id.
- `userId` (string): The API key, or the person signed in, that made the call.
- `models` (object[]): The selectors the call asked for, as it named them.
- `prioritization` (object): The providers it asked to be served by first, those it asked never to be, zdr, zero data retention, deprecated, whether deprecated models could serve it, and maxAge, how old a model could be.
- `streaming` (boolean): Whether it asked for a stream.
- `provider` (string): The provider that served it. Absent when nothing did.
- `model` (string): The model that served it, by its id, publisher/name. Absent when nothing did.
- `ownKey` (boolean): Whether it was served on your own provider key.
- `attempts` (object[]): Every offering the call was put to, in the order the router tried them.
  - `provider` (string): The provider the offering runs on.
  - `model` (string): The model, by its id.
  - `ownKey` (boolean): Whether the attempt ran on your own key.
  - `byoKeyId` (string): The saved key the attempt ran on, as GET /organization/byokeys lists it by id. null for a key sent with the call or Momor's key.
  - `status` (integer): 200 where it answered, the status it failed with, or 0 where the call ended before the attempt did.
  - `operation` (string): The operation the attempt ran. Values: `chat`, `decision`, `transcribe`, `ocr`.
  - `durationMs` (integer): How long the attempt took.
  - `firstOutputMs` (integer): For a streamed attempt that answered, how long until its first output.
  - `inputTokens` (integer): The input tokens the attempt was charged for.
  - `outputTokens` (integer): The tokens the attempt generated.
  - `costUsd` (number): What the attempt cost, in US dollars, at the price of the offering it ran on.
- `status` (integer): How the call ended: 200, the status it failed with, or 499 when the caller hung up first.
- `inputTokens` (integer): Input tokens read in full, over every answer the call was given.
- `outputTokens` (integer): Tokens generated, over every answer.
- `cacheReadTokens` (integer): Input served from a provider’s cache.
- `cacheWriteTokens` (integer): Input written into a provider’s cache.
- `thoughtTokens` (integer): Reasoning tokens a provider counted apart from its output.
- `finishReason` (string): Why the last answer ended, as its provider put it.
- `durationMs` (integer): How long the call took, from routing it to its last answer.
- `firstOutputMs` (integer): For a streamed call, how long until the first answer began.
- `createdAt` (date-time): When the call was made.

To list many calls, or sum them by day, see [usage and costs](/docs/gateway/usage/).

## Errors

| Status | Code | What happened |
| --- | --- | --- |
| `401` | `—` | The key is missing, revoked, expired or not a Momor key. |
| `404` | `—` | No call was made under that id by your organization. |
| `429` | `—` | Too many requests; wait for Retry-After. |

```bash title="Request"
curl https://api.momor.ai/models/requests/4bf92f3577b34da6a3ce929d0e0e4736 \
  -H "Authorization: Bearer $MOMOR_API_KEY"
```

```python
import os
import requests

record = requests.get(
    "https://api.momor.ai/models/requests/4bf92f3577b34da6a3ce929d0e0e4736",
    headers={"Authorization": f"Bearer {os.environ['MOMOR_API_KEY']}"},
).json()
print(sum(attempt["costUsd"] for attempt in record["attempts"]))
```

```typescript
const response = await fetch("https://api.momor.ai/models/requests/4bf92f3577b34da6a3ce929d0e0e4736", {
  headers: { Authorization: `Bearer ${process.env.MOMOR_API_KEY}` },
});
const record = await response.json();
console.log(record.provider, record.attempts);
```

```csharp
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var http = new HttpClient { BaseAddress = new Uri("https://api.momor.ai") };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("MOMOR_API_KEY"));

var record = await http.GetFromJsonAsync<JsonElement>("/models/requests/4bf92f3577b34da6a3ce929d0e0e4736");
Console.WriteLine(record.GetProperty("provider"));
```

```json title="Response"
{
  "requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
  "models": [{ "name": "claude-sonnet-5" }],
  "prioritization": { "ignore": [], "order": [], "sort": "price", "zdr": false },
  "streaming": false,
  "provider": "TogetherAi",
  "model": "anthropic/claude-sonnet-5",
  "ownKey": false,
  "attempts": [
    { "provider": "Anthropic", "model": "anthropic/claude-sonnet-5", "ownKey": false, "byoKeyId": null, "status": 529,
      "operation": "chat", "durationMs": 812, "inputTokens": 0, "outputTokens": 0, "costUsd": 0 },
    { "provider": "TogetherAi", "model": "anthropic/claude-sonnet-5", "ownKey": false, "byoKeyId": null, "status": 200,
      "operation": "chat", "durationMs": 1460, "inputTokens": 1840, "outputTokens": 212, "costUsd": 0.00870 }
  ],
  "status": 200,
  "inputTokens": 1840,
  "outputTokens": 212,
  "cacheReadTokens": 0,
  "cacheWriteTokens": 0,
  "thoughtTokens": 0,
  "finishReason": "stop",
  "durationMs": 2290,
  "createdAt": "2026-10-22T09:14:03.512Z"
}
```

```json
{
  "status": 404,
  "detail": "No call was made under 4bf92f3577b34da6a3ce929d0e0e4736."
}
```
