Skip to content

A workspace's recent AI Gateway requests, newest first: each with its id, created_at, model, the access token that sent it (token_id, token_name), its tokens by kind (input, output, cache_read, cache_write, and of those writes cache_write_hour to the hour-long cache), the format it was sent in (anthropic or openai), who served it (provider: anthropic or workers-ai on g1t's account, the connection's provider on the workspace's own, and connection, that connection's name), what they cost at the model's price (cost_micros) and what the workspace was charged (charged_micros, before included usage and AI credit paid for it; 0 on the workspace's own provider key, own_key), the HTTP status it was answered with, whether it was streamed, duration_ms, and error for one that was refused or failed.

GET/workspaces/{workspace}/gateway/requests

Prompts and answers are never kept. limit is how many, 50 unless given and 200 at most; pass next from one page as before for the next. Requests are kept retention_days (30). Members of the workspace only.

To send requests, see the AI Gateway guide: POST https://models.g1t.sh/anthropic/v1/messages (Anthropic’s format) or https://models.g1t.sh/openai/v1/chat/completions (OpenAI’s) with a workspace access token that has models:write. format is the format a request was sent in; provider who served it (anthropic or workers-ai on g1t’s account, the connection’s provider on the workspace’s own, empty when it was refused before reaching one), and connection the workspace’s own connection by name. cache_write_hour is the part of cache_write written to the hour-long cache. charged_micros is what the request was charged before included usage and AI credit paid for it; the payment itself is on the statement as AI Gateway. Pass next as before for the next page; it is null on the last.

  • Authentication: Required. Send an access token as Authorization: Bearer.
  • MCP tool: billing with action gateway_requests, and the same inputs
  • Scope: An access token needs models:read.
Name Type Required Description
workspace string Yes The workspace’s slug, e.g. “flagon-io”.
Name Type Required Description
limit integer No How many requests, newest first. 50 if not given.
before string No Only requests older than this one: the next of the page before.
curl "https://api.g1t.sh/workspaces/flagon-io/gateway/requests?limit=3" \
-H "Authorization: Bearer $G1T_TOKEN"

A successful request answers 200 with:

{
"requests": [
{
"id": "gw_5f0c2a9e7b1d4c3a8e6f0b12",
"created_at": "2026-10-07T14:02:11.000Z",
"model": "claude-sonnet-5-5",
"token_id": "tok_01kkr4w7d2c9e5f8h1j3m6n0p2",
"token_name": "release-notes",
"input": 1840,
"output": 512,
"cache_read": 12000,
"cache_write": 0,
"cache_write_hour": 0,
"cost_micros": 10000,
"charged_micros": 10000,
"status": 200,
"own_key": false,
"format": "anthropic",
"provider": "anthropic",
"connection": null,
"streamed": true,
"duration_ms": 4210,
"error": null
},
{
"id": "gw_9b3d1f7a5c2e4b6d8f0a1c33",
"created_at": "2026-10-07T14:00:02.000Z",
"model": "qwen3-coder:30b",
"token_id": "tok_01kkr5a2b8c4d6e0f3g5h7j9k1",
"token_name": "triage-bot",
"input": 2210,
"output": 96,
"cache_read": 0,
"cache_write": 0,
"cache_write_hour": 0,
"cost_micros": 0,
"charged_micros": 0,
"status": 200,
"own_key": true,
"format": "openai",
"provider": "openai_endpoint",
"connection": "Office GPU",
"streamed": false,
"duration_ms": 1830,
"error": null
},
{
"id": "gw_1a7e3c5b9d2f4e6a8c0b2d41",
"created_at": "2026-10-07T13:58:40.000Z",
"model": "claude-opus-5-5",
"token_id": "tok_01kkr4w7d2c9e5f8h1j3m6n0p2",
"token_name": "release-notes",
"input": 0,
"output": 0,
"cache_read": 0,
"cache_write": 0,
"cache_write_hour": 0,
"cost_micros": 0,
"charged_micros": 0,
"status": 402,
"own_key": false,
"format": "openai",
"provider": "",
"connection": null,
"streamed": false,
"duration_ms": 38,
"error": "The flagon-io workspace is out of AI credit and has used this month's included usage, so the AI Gateway refuses requests to g1t's models. An owner can buy AI credit or turn on auto-reload at /flagon-io/-/billing#ai-credit."
}
],
"next": "gw_1a7e3c5b9d2f4e6a8c0b2d41",
"retention_days": 30
}

A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.

Status Code When
401 unauthenticated A token is required, or the one sent is not valid.
403 forbidden The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository.
404 not_found It does not exist, or you cannot see it.
422 invalid The input is not valid. message says which field and why.