Roar AI Usage API

Usage, cost, and budgets

GitHub OpenAPI

Operations 10

GET /client/usage Usage summary #
GET /client/budget Budget status #
GET /client/requests Gateway request log #
GET /client/requests/{id} One gateway request #
GET /client/usage/series Usage over time #
GET /client/usage/comparison This period against the last #
GET /client/usage/tools Tool gateway calls #
GET /client/usage/tools/calls Tool gateway call log #
GET /client/requests/recent The most recent calls #
GET /client/requests/window Calls in a time window #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/roar-ai-com:roar-ai-com-usage-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

roar-ai-com-usage-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Roar AI Usage API
  version: 1.0.0
  description: 'One key, two surfaces. The **gateway** (`/v1/*`) is OpenAI-compatible — point any OpenAI SDK at it. The **management API** (`/client/*`) lets an agent provision keys, read spend, and deploy apps. Both authenticate with a `roar_live_…` key sent as `Authorization: Bearer `. A key carries scopes (inference, keys:read, keys:write, usage:read, requests:read, apps:read, apps:deploy, data:read, projects:write, webhooks:read, webhooks:write, mcp:read, mcp:write); each `/client` route requires a specific one. There is also a hosted MCP server at `POST /mcp` exposing the same operations as tools.'
servers:
- url: https://api.roar-ai.com
security:
- BearerAuth: []
tags:
- name: Usage
  description: Usage, cost, and budgets
paths:
  /client/usage:
    get:
      tags:
      - Usage
      summary: Usage summary
      description: 'Token counts, request volume, latency, and cost — headline totals, a per-model breakdown, and the recent requests themselves. Model calls only: tool gateway calls are reported by `GET /client/usage/tools`. Requires `usage:read`.'
      parameters:
      - name: from
        in: query
        schema:
          type: string
          format: date
      - name: to
        in: query
        schema:
          type: string
          format: date
      - name: limit
        in: query
        schema:
          type: integer
          default: 100
        description: How many recent requests to return (max 1000)
      - name: keyId
        in: query
        schema:
          type: string
          format: uuid
        description: Limit to one API key
      responses:
        '200':
          description: Usage report
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageReport'
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientUsage
      x-operation-id-source: derived
  /client/budget:
    get:
      tags:
      - Usage
      summary: Budget status
      description: Real-time spend vs. cap per budgeted scope, and the company credit balance (`balanceUsd`). Requires `usage:read`.
      responses:
        '200':
          description: Budget report
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BudgetReport'
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientBudget
      x-operation-id-source: derived
  /client/requests:
    get:
      tags:
      - Usage
      summary: Gateway request log
      description: 'One row per model call through `/v1` (tool gateway calls are `GET /client/usage/tools/calls`): model, tokens, cost, latency, time to first token (`ttftMs`, streamed calls) and status. Narrow with `from`/`to`, `keyId`, `model` (one model, exactly), `q` (request id, or text in the model or endpoint) and `band` — `errors`, or `slow`: a streamed call whose first token took over 5s, or an unstreamed one over 30s. Keyset-paginated — pass the previous response''s `nextCursor` as `cursor`. Requires `usage:read`.'
      responses:
        '200':
          description: Requests, newest first
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientRequests
      x-operation-id-source: derived
  /client/requests/{id}:
    get:
      tags:
      - Usage
      summary: One gateway request
      description: A single call in full. Prompt and response bodies are included only if your project role may read them and the account has request logging switched on. Requires `usage:read`.
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: The request
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientRequestsById
      x-operation-id-source: derived
  /client/usage/series:
    get:
      tags:
      - Usage
      summary: Usage over time
      description: A time series of spend and request volume for charting, rather than the totals `GET /client/usage` returns. Narrow with `from`/`to`, `keyId` and `model` (one model, exactly). Requires `usage:read`.
      responses:
        '200':
          description: One point per bucket. (Response shape not yet modelled in this spec.)
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientUsageSeries
      x-operation-id-source: derived
  /client/usage/comparison:
    get:
      tags:
      - Usage
      summary: This period against the last
      description: The same usage figures for the current and previous period, so a caller can show a change without computing two windows. Requires `usage:read`.
      responses:
        '200':
          description: Both periods. (Response shape not yet modelled in this spec.)
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientUsageComparison
      x-operation-id-source: derived
  /client/usage/tools:
    get:
      tags:
      - Usage
      summary: Tool gateway calls
      description: 'Calls your agents made through the tool gateway: per tool, failures (`errors`) apart from calls a rule stopped (`stopped` — approvals, limits, the guardrail), every code seen, what the guardrail masked or stopped, latency, which key calls which tool, and `series` — calls per hour (per day past two days) for a timeline. These are NOT in `GET /client/usage`, whose figures are model calls only. No cost — gateway tool calls are free. (A model’s own built-in web search is billed per search and appears in `GET /client/usage` instead.) Optional `from`/`to` and `keyId`. Requires `usage:read`.'
      parameters:
      - name: from
        in: query
        schema:
          type: string
          format: date-time
      - name: to
        in: query
        schema:
          type: string
          format: date-time
      - name: keyId
        in: query
        schema:
          type: string
          format: uuid
        description: Limit to one API key
      responses:
        '200':
          description: Tool call figures
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolUsageReport'
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientUsageTools
      x-operation-id-source: derived
  /client/usage/tools/calls:
    get:
      tags:
      - Usage
      summary: Tool gateway call log
      description: 'One row per tool call, newest first: which tool, which key, status, latency, guardrail outcome and error code. **Never the arguments or the result** — they are not stored. `band` is `errors` (failed calls — since 2026-09-27 NOT the calls a rule stopped or whose answer the guardrail withheld), `stopped` (calls a rule stopped before the tool: approval, a limit, the guardrail on the arguments) or `guardrail`; `endpoint` narrows to one tool (`mcp:/`). Keyset-paginated: pass the previous response''s `nextCursor` as `cursor`. Requires `usage:read`.'
      parameters:
      - name: from
        in: query
        schema:
          type: string
          format: date-time
      - name: to
        in: query
        schema:
          type: string
          format: date-time
      - name: keyId
        in: query
        schema:
          type: string
          format: uuid
      - name: band
        in: query
        schema:
          type: string
          enum:
          - all
          - errors
          - stopped
          - guardrail
      - name: endpoint
        in: query
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          default: 50
          maximum: 200
      - name: cursor
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Tool calls, newest first
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolCallPage'
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientUsageToolsCalls
      x-operation-id-source: derived
  /client/requests/recent:
    get:
      tags:
      - Usage
      summary: The most recent calls
      description: Metadata only — model, status, latency, tokens and cost. **Never prompt or response content**, which needs `requests:read` and `GET /client/requests/{id}`. Requires `usage:read`.
      responses:
        '200':
          description: Recent request metadata. (Response shape not yet modelled in this spec.)
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientRequestsRecent
      x-operation-id-source: derived
  /client/requests/window:
    get:
      tags:
      - Usage
      summary: Calls in a time window
      description: The same metadata as `/requests/recent`, bounded by an explicit window rather than a count. Requires `usage:read`.
      responses:
        '200':
          description: Request metadata for the window. (Response shape not yet modelled in this spec.)
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Key lacks usage:read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getClientRequestsWindow
      x-operation-id-source: derived
components:
  schemas:
    ModelUsage:
      type: object
      required:
      - model
      - internalFeature
      - requests
      - costUsd
      - inputTokens
      - outputTokens
      - avgLatencyMs
      - errors
      properties:
        model:
          type: string
          nullable: true
          description: 'The model the caller asked for. NULL when `internalFeature` is set: that row is one of our own features calling a model on your behalf, and which model it chose is ours rather than yours.'
        internalFeature:
          type: string
          nullable: true
          description: Set when this row is a platform feature — the automatic deploy fix, or setup advice — rather than a request you made. Billed to you like any other usage; grouped here by the feature so the spend is accountable without naming a model you never chose.
        requests:
          type: integer
        costUsd:
          type: string
          description: Decimal USD as a string
        inputTokens:
          type: integer
        outputTokens:
          type: integer
        avgLatencyMs:
          type: integer
        errors:
          type: integer
    Error:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - message
          - type
          - code
          - param
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
              nullable: true
            param:
              type: string
              nullable: true
    UsageSummary:
      type: object
      required:
      - requests
      - inputTokens
      - outputTokens
      - costUsd
      - cacheSavingsUsd
      - promptCacheRequests
      - avgLatencyMs
      - p95LatencyMs
      - avgTtftMs
      - cacheHits
      - failovers
      - errors
      - clientAborted
      - refused
      - builtinToolUsd
      - builtinToolCalls
      properties:
        requests:
          type: integer
        inputTokens:
          type: integer
        outputTokens:
          type: integer
        costUsd:
          type: string
          description: Decimal USD as a string
        cacheSavingsUsd:
          type: string
          description: What the provider's prompt cache saved over the base input rate. A different mechanism from `cacheHits`, over a disjoint set of requests.
        promptCacheRequests:
          type: integer
          description: Requests that contributed to `cacheSavingsUsd`
        avgLatencyMs:
          type: integer
        p95LatencyMs:
          type: integer
        avgTtftMs:
          type: integer
          description: Average time to first token, streaming requests only
        cacheHits:
          type: integer
          description: Requests answered from the response cache — no upstream call, billed $0
        failovers:
          type: integer
          description: Requests that needed more than one attempt
        errors:
          type: integer
          description: Requests that failed. Excludes cancellations and refusals for credit — see `clientAborted` and `refused`.
        clientAborted:
          type: integer
          description: Requests the caller hung up on before they finished
        refused:
          type: integer
          description: Requests refused because credit ran out or a budget was reached. Not failures, so not in `errors`.
        builtinToolUsd:
          type: string
          description: The part of `costUsd` charged for built-in tools such as web search — included in `costUsd`, not added to it
        builtinToolCalls:
          type: object
          additionalProperties:
            type: integer
          description: 'How many of each priced built-in tool ran, e.g. `{ "web_search": 12 }`'
    BudgetReport:
      type: object
      required:
      - data
      - summary
      - balanceUsd
      - topUpUrl
      properties:
        balanceUsd:
          type: number
          description: The company's prepaid credit balance in USD — the number on Billing. Readable by any key with `usage:read`, so an app can warn before it runs out. The statement and top-ups are not available to keys.
        topUpUrl:
          type: string
          description: 'The console page where an owner or admin adds credit. A link only: a key cannot start a payment.'
        data:
          type: array
          items:
            $ref: '#/components/schemas/BudgetStatus'
        summary:
          type: object
          required:
          - tracked
          - alerting
          - exceeded
          properties:
            tracked:
              type: integer
            alerting:
              type: integer
            exceeded:
              type: integer
    ToolUsageSummary:
      type: object
      required:
      - calls
      - errors
      - stopped
      - withheld
      - redacted
      - blocked
      - avgLatencyMs
      - p95LatencyMs
      properties:
        calls:
          type: integer
        errors:
          type: integer
          description: Calls that FAILED — the tool, its server or we broke (including `tool_error`, an HTTP 200), or no such tool. Since 2026-09-27 this no longer includes calls a rule stopped (`stopped`) or whose answer the guardrail withheld (`withheld`); a monitor on `errors` that expected those should add them
        stopped:
          type: integer
          description: Calls a rule stopped before they reached the tool — waiting for or declined an approval, over a limit, too many at once, or the guardrail refusing the arguments. Not failures
        withheld:
          type: integer
          description: Calls whose tool ran and whose answer the guardrail withheld — a change may have happened. Not failures
        redacted:
          type: integer
          description: Calls whose arguments or result the guardrail masked
        blocked:
          type: integer
          description: 'Calls the guardrail blocked: arguments refused (in `stopped`) or answer withheld (`withheld`)'
        avgLatencyMs:
          type: integer
          nullable: true
          description: Over calls that reached a tool; null when none did
        p95LatencyMs:
          type: integer
          nullable: true
          description: Over calls that reached a tool; null when none did
    BudgetStatus:
      type: object
      required:
      - scope
      - id
      - spendLimitUsd
      - budgetPeriod
      - hardCap
      - alertAtPct
      - periodStart
      - spendUsd
      - pctUsed
      - state
      properties:
        scope:
          type: string
          enum:
          - client
          - project
          - key
        id:
          type: string
          format: uuid
        name:
          type: string
          description: Absent for an unnamed key
        spendLimitUsd:
          type: number
        budgetPeriod:
          type: string
          enum:
          - day
          - week
          - month
          - total
        hardCap:
          type: boolean
        alertAtPct:
          type: integer
        periodStart:
          type: string
          format: date-time
        spendUsd:
          type: number
        pctUsed:
          type: number
          nullable: true
        state:
          type: string
          enum:
          - ok
          - alerting
          - exceeded
    UsageRecord:
      type: object
      required:
      - id
      - apiKeyId
      - requestedModel
      - internalFeature
      - endpoint
      - status
      - inputTokens
      - outputTokens
      - costUsd
      - builtinToolCalls
      - builtinToolUsd
      - latencyMs
      - cached
      - requestId
      - errorCode
      - ttftMs
      - toolsAuto
      - documentPages
      - documentScannedPages
      - via
      - createdAt
      properties:
        id:
          type: integer
        apiKeyId:
          type: string
          format: uuid
          nullable: true
        requestedModel:
          type: string
          nullable: true
          description: The model you asked for. Null when Roar made the call for you — see internalFeature
        internalFeature:
          type: string
          nullable: true
          description: 'Set when Roar made this call on your behalf: `insight` (app setup advice), `autofix` (automatic deploy fix), `explain` (deploy failure explainer). Null for your own requests'
        endpoint:
          type: string
        status:
          type: integer
          description: HTTP status we answered with
        inputTokens:
          type: integer
          nullable: true
        outputTokens:
          type: integer
          nullable: true
        costUsd:
          type: string
          description: Decimal USD as a string
        builtinToolCalls:
          type: object
          nullable: true
          additionalProperties:
            type: integer
          description: 'Built-in tools that ran on this call, e.g. `{ "web_search": 2 }`; null when none did'
        builtinToolUsd:
          type: string
          description: The part of `costUsd` charged for those tools — included in it, not added
        latencyMs:
          type: integer
          nullable: true
        cached:
          type: boolean
        requestId:
          type: string
          nullable: true
        errorCode:
          type: string
          nullable: true
        ttftMs:
          type: integer
          nullable: true
          description: 'Time to the first token, for a streamed call: when the first text, reasoning or tool call arrived. Null when not streamed, or when no output arrived'
        toolsAuto:
          type: boolean
          description: Roar added your company's tools to this request itself — the app's “Let this app's AI use its tools” switch
        documentPages:
          type: integer
          nullable: true
          description: PDF pages we read for this request so the model could take them. Null when no document was converted
        documentScannedPages:
          type: integer
          nullable: true
          description: Of those pages, how many were scans sent to the model as page images. Null when no document was converted
        ignoredParams:
          type: array
          items:
            type: string
          nullable: true
          description: Sampling settings this request was served without, because the model runs at a fixed configuration (temperature, top_p). Also sent as the x-roar-ignored-params response header. Null when none were
        via:
          type: string
          nullable: true
          enum:
          - mcp
          - null
          description: mcp when an assistant connected over MCP made this call with the send_message or generate_image tool; null for every other call
        createdAt:
          type: string
          format: date-time
    ToolUsageReport:
      type: object
      required:
      - summary
      - byTool
      - byError
      - byKey
      - series
      properties:
        summary:
          $ref: '#/components/schemas/ToolUsageSummary'
        series:
          type: array
          description: Calls per hour (per day past two days), oldest first; an hour with no calls is absent
          items:
            type: object
            required:
            - bucket
            - calls
            - errors
            - stopped
            properties:
              bucket:
                type: string
                format: date-time
              calls:
                type: integer
              errors:
                type: integer
              stopped:
                type: integer
        byTool:
          type: array
          items:
            type: object
            required:
            - endpoint
            - tool
            - calls
            - errors
            - stopped
            - withheld
            - redacted
            - blocked
            - avgLatencyMs
            - p95LatencyMs
            - lastCalledAt
            properties:
              endpoint:
                type: string
                description: '`mcp:<server>/<tool>`, or `mcp:gateway` for a name that matched no tool'
              tool:
                type: string
                nullable: true
                description: '`<server>/<tool>`; null for the `mcp:gateway` bucket'
              calls:
                type: integer
              errors:
                type: integer
              stopped:
                type: integer
              withheld:
                type: integer
              redacted:
                type: integer
              blocked:
                type: integer
              avgLatencyMs:
                type: integer
                nullable: true
              p95LatencyMs:
                type: integer
                nullable: true
              lastCalledAt:
                type: string
                format: date-time
        byError:
          type: array
          items:
            type: object
            required:
            - code
            - calls
            properties:
              code:
                type: string
                enum:
                - unknown_tool
                - rate_limited
                - concurrency
                - guardrail_blocked
                - guardrail_args_blocked
                - upstream_error
                - tool_error
                - internal_error
                - approval_pending
                - approval_denied
                - grant_limit
              calls:
                type: integer
                description: 'Rows, not refusals: repeated refusals are logged once per minute per key'
        byKey:
          type: array
          description: Which key, filed under which project, called which tool
          items:
            type: object
            required:
            - apiKeyId
            - keyName
            - projectId
            - projectName
            - endpoint
            - tool
            - calls
            - errors
            - stopped
            properties:
              apiKeyId:
                type: string
                format: uuid
                nullable: true
                description: Null once the key is deleted
              keyName:
                type: string
                nullable: true
              projectId:
                type: string
                format: uuid
                nullable: true
              projectName:
                type: string
                nullable: true
              endpoint:
                type: string
              tool:
                type: string
                nullable: true
              calls:
                type: integer
              errors:
                type: integer
              stopped:
                type: integer
    ToolCallPage:
      type: object
      required:
      - data
      - nextCursor
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ToolCallRow'
        nextCursor:
          type: string
          nullable: true
          description: Pass back as `cursor` for the next page; null on the last
    ToolCallRow:
      type: object
      required:
      - id
      - apiKeyId
      - endpoint
      - tool
      - status
      - latencyMs
      - guardrailAction
      - errorCode
      - requestId
      - createdAt
      properties:
        id:
          type: integer
        apiKeyId:
          type: string
          format: uuid
          nullable: true
        endpoint:
          type: string
        tool:
          type: string
          nullable: true
        status:
          type: integer
        latencyMs:
          type: integer
        guardrailAction:
          type: string
          enum:
          - redact
          - block
          nullable: true
        errorCode:
          type: string
          enum:
          - unknown_tool
          - rate_limited
          - concurrency
          - guardrail_blocked
          - guardrail_args_blocked
          - upstream_error
          - tool_error
          - internal_error
          - approval_pending
          - approval_denied
          - grant_limit
          nullable: true
        requestId:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
    UsageReport:
      type: object
      required:
      - summary
      - byModel
      - data
      properties:
        summary:
          $ref: '#/components/schemas/UsageSummary'
        byModel:
          type: array
          items:
            $ref: '#/components/schemas/ModelUsage'
        data:
          type: array
          items:
            $ref: '#/components/schemas/UsageRecord'
          description: Recent requests, newest first (`limit`, default 100)
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: roar_live_…
      description: A scoped Roar API key.
externalDocs:
  description: Guides and the interactive reference
  url: https://roar-ai.com/docs