Skip to main content
GET
/
projects
/
{id}
/
ai-gateway
/
usage
Get project usage
curl --request GET \
  --url https://api.specular.dev/projects/{id}/ai-gateway/usage \
  --header 'Authorization: Bearer <token>'
{
  "usage": [
    {
      "id": "<string>",
      "projectId": "<string>",
      "branchId": "<string>",
      "model": "<string>",
      "requestPath": "<string>",
      "inputTokens": 123,
      "outputTokens": 123,
      "costUsd": 123,
      "requestedAt": "2023-11-07T05:31:56Z"
    }
  ],
  "total": 123,
  "limit": 123,
  "offset": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication with API key (format: Bearer sk_xxx)

Path Parameters

id
string
required

Project ID

Query Parameters

limit
integer
default:20

Maximum number of records to return (1-100)

Required range: 1 <= x <= 100
offset
integer
default:0

Number of records to skip

Required range: x >= 0

Response

AI Gateway usage records

AI Gateway usage records

usage
object[]
total
integer

Total number of records

limit
integer
offset
integer