Home / Docs / API reference
/v1/generation/{id}
GET /v1/generation/{id}
Authentication relay key (bearer)
Path parameters
id required | string |
Example request
curl
curl https://api.massrelay.ai/v1/generation/{id} \
-H "Authorization: Bearer $RELAY_KEY"Python
import os, requests
r = requests.get(
"https://api.massrelay.ai/v1/generation/{id}",
headers={"Authorization": f"Bearer {os.environ['RELAY_KEY']}"},
)
r.raise_for_status()
print(r.json())TypeScript
const r = await fetch("https://api.massrelay.ai/v1/generation/{id}", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.RELAY_KEY}` },
});
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`);
console.log(await r.json());Response
| Field | Type | Description |
|---|---|---|
object required | string | The kind of object returned, for example chat.completion. Always "generation". |
id required | string | The answer's id. |
model required | string or null | The model id. In a request it is optional: without it the key's routing chooses. |
provider required | string or null | |
inputTokens required | integer | |
outputTokens required | integer | |
unit required | string | Always "mu". |
costMu required | integer | micro-dollars, the unit of account |
fee required | object or null | |
fee.costMu | integer | micro-dollars, the unit of account |
fee.plan | string or null | |
fee.reason | string or null | |
latencyMs required | integer or null | |
createdAt required | string or null | |
explain required | string | the /v1/route/explain/{id} path |
Example response (shape)
{
"object": "generation",
"id": "<id>",
"model": "provider/model-id",
"provider": "<provider>",
"inputTokens": 0,
"outputTokens": 0,
"unit": "mu",
"costMu": 0,
"fee": {
"costMu": 0,
"plan": "<plan>",
"reason": "<reason>"
},
"latencyMs": "<latencyMs>",
"createdAt": "<createdAt>",
"explain": "<explain>"
}Common errors
401invalid_api_key403insufficient_scope429over the request rate; read Retry-After
Every error has the same JSON shape; see Errors and Limits.
Full schema (JSON)
Response schema
{
"description": "404 decision_not_found for another key's, another workspace's or a missing id.",
"type": "object",
"required": [
"object",
"id",
"model",
"provider",
"inputTokens",
"outputTokens",
"unit",
"costMu",
"fee",
"latencyMs",
"createdAt",
"explain"
],
"properties": {
"object": {
"const": "generation"
},
"id": {
"type": "string"
},
"model": {
"type": [
"string",
"null"
]
},
"provider": {
"type": [
"string",
"null"
]
},
"inputTokens": {
"type": "integer"
},
"outputTokens": {
"type": "integer"
},
"unit": {
"const": "mu"
},
"costMu": {
"type": "integer",
"description": "micro-dollars, the unit of account"
},
"fee": {
"type": [
"object",
"null"
],
"properties": {
"costMu": {
"type": "integer",
"description": "micro-dollars, the unit of account"
},
"plan": {
"type": [
"string",
"null"
]
},
"reason": {
"type": [
"string",
"null"
]
}
}
},
"latencyMs": {
"type": [
"integer",
"null"
]
},
"createdAt": {
"type": [
"string",
"null"
]
},
"explain": {
"type": "string",
"description": "the /v1/route/explain/{id} path"
}
}
}