UsageMax Private gateway API

The Private gateway API from UsageMax — 5 operation(s) for private gateway.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 6

POST /api/v1/gateway/receipts Write gateway receipts #
GET /api/v1/gateway/receipts List gateway receipts #
GET /api/v1/gateway/receipts/{requestId} Get gateway receipt #
POST /api/v1/gateway/evals Publish gateway eval run #
GET /api/v1/gateway/operations Read gateway operations #
GET /api/v1/gateway/status Get gateway status #

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/usagemax-com:usagemax-com-private-gateway-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

usagemax-com-private-gateway-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: UsageMax Private gateway API
  version: 1.0.0
  description: API version 1. Public UsageMax read APIs and the authenticated, content-free CLI ingestion contract. UsageMax never accepts prompts, completions, source code, file paths, tool arguments, or secrets. Version 1 is supported; deprecated endpoints return Deprecation and Sunset headers.
  contact:
    name: UsageMax
    url: https://usagemax.com/contact
    email: hello@usagemax.com
  license:
    name: MIT
    url: https://github.com/SYMBaiEX/usagemax/blob/main/LICENSE
servers:
- url: https://usagemax.com
  description: Production API
tags:
- name: Private gateway
paths:
  /api/v1/gateway/receipts:
    post:
      tags:
      - Private gateway
      operationId: writeGatewayReceipts
      description: Write settled requests to the project attached to the ingest key. Repeated revisions with identical data are idempotent. Later revisions can add evidence.
      security:
      - gatewayBearer: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - receipts
              properties:
                receipts:
                  type: array
                  minItems: 1
                  maxItems: 50
                  items:
                    $ref: '#/components/schemas/GatewayReceipt'
      responses:
        '200':
          description: Per-receipt results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayWriteResult'
        '400':
          description: Invalid receipt, request ID, or report filters.
        '401':
          description: Invalid, revoked, or inactive gateway key.
        '403':
          description: The gateway key lacks the required scope.
        '413':
          description: Body exceeds 64 KiB.
        '415':
          description: Use application/json.
        '429':
          description: Project key rate limit reached. Retry with backoff.
        '503':
          description: The UsageMax gateway service is unavailable.
      summary: Write gateway receipts
      x-summary-source: derived
    get:
      tags:
      - Private gateway
      operationId: listGatewayReceipts
      description: Read a bounded slice of private settlements for the report key's project. The inclusive UTC range can cover up to 31 days.
      security:
      - gatewayBearer: []
      parameters:
      - name: from
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: through
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: limit
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 50
      responses:
        '200':
          description: Project receipts and coverage.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayReport'
        '400':
          description: Invalid receipt, request ID, or report filters.
        '401':
          description: Invalid, revoked, or inactive gateway key.
        '403':
          description: The gateway key lacks the required scope.
        '429':
          description: Project key rate limit reached. Retry with backoff.
        '503':
          description: The UsageMax gateway service is unavailable.
      summary: List gateway receipts
      x-summary-source: derived
  /api/v1/gateway/receipts/{requestId}:
    get:
      tags:
      - Private gateway
      operationId: getGatewayReceipt
      description: Read a single settlement with the project's report key.
      security:
      - gatewayBearer: []
      parameters:
      - name: requestId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$
      responses:
        '200':
          description: The latest settled request revision.
          content:
            application/json:
              schema:
                type: object
                required:
                - receipt
                properties:
                  receipt:
                    $ref: '#/components/schemas/GatewayReceipt'
        '400':
          description: Invalid receipt, request ID, or report filters.
        '401':
          description: Invalid, revoked, or inactive gateway key.
        '403':
          description: The gateway key lacks the required scope.
        '404':
          description: The request was not found in this project.
        '429':
          description: Project key rate limit reached. Retry with backoff.
        '503':
          description: The UsageMax gateway service is unavailable.
      summary: Get gateway receipt
      x-summary-source: derived
  /api/v1/gateway/evals:
    post:
      tags:
      - Private gateway
      operationId: publishGatewayEvalRun
      description: Save a content-free eval result in the ingest key's project. Retrying identical evidence with the same run ID is idempotent. An optional baseline checks quality for matching routes and cases.
      security:
      - gatewayBearer: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayEvalRun'
      responses:
        '200':
          description: Stored run and its hosted quality gate, when a baseline was requested.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayEvalReceipt'
        '400':
          description: Invalid eval run.
        '401':
          description: Invalid, revoked, or inactive gateway key.
        '403':
          description: The gateway key lacks the required scope.
        '404':
          description: The baseline run is absent or expired in this project.
        '409':
          description: The run ID conflicts with stored evidence, or the baseline has a different mode, dataset, evaluator, routes, or cases.
        '413':
          description: Body exceeds 64 KiB.
        '415':
          description: Use application/json.
        '429':
          description: Project key rate limit reached. Retry with backoff.
        '503':
          description: The UsageMax gateway service is unavailable.
      summary: Publish gateway eval run
      x-summary-source: derived
  /api/v1/gateway/operations:
    get:
      tags:
      - Private gateway
      operationId: readGatewayOperations
      description: Read project-scoped inference analytics, recent traces and scheduled alert history. Up to 2,000 newest retained receipts are analyzed over an inclusive UTC range of up to 31 days.
      security:
      - gatewayBearer: []
      parameters:
      - name: from
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: through
        in: query
        required: true
        schema:
          type: string
          format: date
      responses:
        '200':
          description: Gateway operations and reporting coverage.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayOperations'
        '400':
          description: Invalid receipt, request ID, or report filters.
        '401':
          description: Invalid, revoked, or inactive gateway key.
        '403':
          description: The gateway key lacks the required scope.
        '429':
          description: Project key rate limit reached. Retry with backoff.
        '503':
          description: The UsageMax gateway service is unavailable.
      summary: Read gateway operations
      x-summary-source: derived
  /api/v1/gateway/status:
    get:
      tags:
      - Private gateway
      operationId: getGatewayStatus
      description: Check connectivity and the scope of a project gateway key.
      security:
      - gatewayBearer: []
      responses:
        '200':
          description: Scope and latest successful ingestion or read, where available.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayStatus'
        '400':
          description: Invalid receipt, request ID, or report filters.
        '401':
          description: Invalid, revoked, or inactive gateway key.
        '403':
          description: The gateway key lacks the required scope.
        '429':
          description: Project key rate limit reached. Retry with backoff.
        '503':
          description: The UsageMax gateway service is unavailable.
      summary: Get gateway status
      x-summary-source: derived
components:
  schemas:
    GatewayReport:
      type: object
      required:
      - receipts
      - truncated
      properties:
        receipts:
          type: array
          items:
            $ref: '#/components/schemas/GatewayReceipt'
        truncated:
          type: boolean
    GatewayReceipt:
      type: object
      additionalProperties: false
      required:
      - schemaVersion
      - requestId
      - revision
      - model
      - provider
      - status
      - settledAt
      - currency
      - customerChargeNanos
      - providerCostNanos
      - providerCostBasis
      - usage
      properties:
        schemaVersion:
          const: 1
        requestId:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$
        revision:
          type: integer
          minimum: 1
        provider:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
        model:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
        resolvedModel:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
        traceId:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$
        trace:
          type: object
          additionalProperties: false
          required:
          - billingStatus
          - spans
          properties:
            billingStatus:
              type: string
              enum:
              - final
              - pending
            spans:
              type: array
              minItems: 1
              maxItems: 12
              items:
                $ref: '#/components/schemas/GatewaySpan'
        status:
          type: string
          enum:
          - ok
          - error
          - cancelled
        settledAt:
          type: integer
          minimum: 0
          description: Unix epoch in milliseconds.
        startedAt:
          type: integer
          minimum: 0
          description: Unix epoch in milliseconds.
        firstTokenAt:
          type: integer
          minimum: 0
          description: Unix epoch in milliseconds.
        stream:
          type: boolean
        currency:
          const: USD
        customerChargeNanos:
          type:
          - integer
          - 'null'
          minimum: 0
          description: USD nanodollars. A null value means this amount was unavailable.
        providerCostNanos:
          type:
          - integer
          - 'null'
          minimum: 0
          description: USD nanodollars. A null value means this amount was unavailable.
        providerCostBasis:
          type: string
          enum:
          - provider_reported
          - invoice_confirmed
          - estimated
          - unknown
        usage:
          type: object
          additionalProperties: false
          properties:
            inputTokens:
              type: integer
              minimum: 0
            outputTokens:
              type: integer
              minimum: 0
            cacheReadTokens:
              type: integer
              minimum: 0
            cacheWriteTokens:
              type: integer
              minimum: 0
            reasoningTokens:
              type: integer
              minimum: 0
            reportedTotalTokens:
              type: integer
              minimum: 0
            unclassifiedTokens:
              type: integer
              minimum: 0
    GatewaySpan:
      type: object
      additionalProperties: false
      required:
      - spanId
      - kind
      - startedAt
      - endedAt
      - status
      properties:
        spanId:
          type: string
          pattern: ^[a-f0-9]{16}$
        parentSpanId:
          type: string
          pattern: ^[a-f0-9]{16}$
        kind:
          type: string
          enum:
          - request
          - reservation
          - provider
          - verification
          - settlement
          - recovery
        startedAt:
          type: integer
          minimum: 0
          description: Unix epoch in milliseconds.
        endedAt:
          type: integer
          minimum: 0
          description: Unix epoch in milliseconds.
        status:
          type: string
          enum:
          - ok
          - error
        httpStatus:
          type: integer
          minimum: 100
          maximum: 599
        provider:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
        model:
          type: string
          minLength: 1
          maxLength: 120
          pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
        outcome:
          type: string
          enum:
          - success
          - http_error
          - transport_error
          - invalid_response
          - verification_failed
          - incomplete_stream
    GatewayEvalReceipt:
      type: object
      additionalProperties: false
      required:
      - runId
      - status
      - gate
      properties:
        runId:
          type: string
          pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
          minLength: 1
          maxLength: 64
        status:
          type: string
          enum:
          - accepted
          - replay
        gate:
          type:
          - object
          - 'null'
          additionalProperties: false
          required:
          - passed
          - regressions
          properties:
            passed:
              type: boolean
            regressions:
              type: array
              maxItems: 40
              items:
                type: object
                additionalProperties: false
                required:
                - routeId
                - caseId
                properties:
                  routeId:
                    type: string
                    pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
                    minLength: 1
                    maxLength: 64
                  caseId:
                    type: string
                    pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
                    minLength: 1
                    maxLength: 64
    GatewayEvalRun:
      type: object
      additionalProperties: false
      required:
      - runId
      - report
      properties:
        runId:
          type: string
          pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
          minLength: 1
          maxLength: 64
        baselineRunId:
          type: string
          pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
          minLength: 1
          maxLength: 64
        report:
          type: object
          additionalProperties: false
          required:
          - mode
          - dataset
          - datasetVersion
          - evaluator
          - routes
          properties:
            mode:
              type: string
              enum:
              - fixture
              - sonnely
            dataset:
              type: string
              pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
              minLength: 1
              maxLength: 64
            datasetVersion:
              type: string
              pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
              minLength: 1
              maxLength: 64
            evaluator:
              type: string
              pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
              minLength: 1
              maxLength: 64
            routes:
              type: array
              minItems: 2
              maxItems: 2
              items:
                type: object
                additionalProperties: false
                required:
                - id
                - provider
                - model
                - passed
                - total
                - results
                properties:
                  id:
                    type: string
                    pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
                    minLength: 1
                    maxLength: 64
                  provider:
                    type: string
                    pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
                    minLength: 1
                    maxLength: 64
                  model:
                    type: string
                    pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,99}$
                  passed:
                    type: integer
                    minimum: 0
                    maximum: 20
                  total:
                    type: integer
                    minimum: 1
                    maximum: 20
                  results:
                    type: array
                    minItems: 1
                    maxItems: 20
                    items:
                      type: object
                      additionalProperties: false
                      required:
                      - caseId
                      - passed
                      - inputTokens
                      - outputTokens
                      - chargedMicrousd
                      - latencyMs
                      properties:
                        caseId:
                          type: string
                          pattern: ^[a-z0-9][a-z0-9._-]{0,63}$
                          minLength: 1
                          maxLength: 64
                        passed:
                          type: boolean
                        inputTokens:
                          type: integer
                          minimum: 0
                          maximum: 1000000000000
                        outputTokens:
                          type: integer
                          minimum: 0
                          maximum: 1000000000000
                        chargedMicrousd:
                          type: integer
                          minimum: 0
                          maximum: 1000000000000
                          description: Settled customer charge in USD millionths, as submitted by the runner.
                        latencyMs:
                          type: integer
                          minimum: 0
                          maximum: 1000000000000
    GatewayStatus:
      type: object
      required:
      - ok
      - scope
      - lastSuccessAt
      properties:
        ok:
          const: true
        scope:
          type: string
          enum:
          - ingest
          - report
        lastSuccessAt:
          type:
          - integer
          - 'null'
    GatewayOperations:
      type: object
      required:
      - from
      - through
      - retainedFromAt
      - generatedAt
      - latestReceiptAt
      - latestRequestId
      - truncated
      - groupsTruncated
      - limit
      - overall
      - recent
      - daily
      - providers
      - models
      - alerts
      properties:
        from:
          type: string
          format: date
        through:
          type: string
          format: date
        retainedFromAt:
          type: integer
          minimum: 0
          description: Unix epoch in milliseconds.
        generatedAt:
          type: integer
          minimum: 0
          description: Unix epoch in milliseconds.
        latestReceiptAt:
          type:
          - integer
          - 'null'
        latestRequestId:
          type:
          - string
          - 'null'
        truncated:
          type: boolean
        groupsTruncated:
          type: boolean
        limit:
          type: integer
          minimum: 0
        overall:
          $ref: '#/components/schemas/GatewayMetrics'
        daily:
          type: array
          items:
            $ref: '#/components/schemas/GatewayMetrics'
        providers:
          type: array
          items:
            $ref: '#/components/schemas/GatewayMetrics'
        models:
          type: array
          items:
            $ref: '#/components/schemas/GatewayMetrics'
        recent:
          type: array
          items:
            type: object
            required:
            - requestId
            - provider
            - model
            - settledAt
            - status
            - hasTrace
            properties:
              requestId:
                type: string
                minLength: 1
                maxLength: 120
                pattern: ^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$
              provider:
                type: string
                minLength: 1
                maxLength: 120
                pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
              model:
                type: string
                minLength: 1
                maxLength: 120
                pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
              settledAt:
                type: integer
                minimum: 0
                description: Unix epoch in milliseconds.
              status:
                type: string
                enum:
                - ok
                - error
                - cancelled
              hasTrace:
                type: boolean
        alerts:
          type: object
          required:
          - evaluatedAt
          - truncated
          - items
          properties:
            evaluatedAt:
              type:
              - integer
              - 'null'
            truncated:
              type: boolean
            items:
              type: array
              items:
                type: object
                required:
                - key
                - rule
                - provider
                - samples
                - observed
                - openedAt
                - updatedAt
                properties:
                  key:
                    type: string
                  provider:
                    type: string
                    minLength: 1
                    maxLength: 120
                    pattern: ^[A-Za-z0-9][A-Za-z0-9_.:@/-]*$
                  samples:
                    type: integer
                    minimum: 0
                  observed:
                    type: integer
                    minimum: 0
                  rule:
                    type: string
                    enum:
                    - provider_errors
                    - slow_provider
                    - billing_pending
                  openedAt:
                    type: integer
                    minimum: 0
                    description: Unix epoch in milliseconds.
                  updatedAt:
                    type: integer
                    minimum: 0
                    description: Unix epoch in milliseconds.
                  resolvedAt:
                    type: integer
                    minimum: 0
                    description: Unix epoch in milliseconds.
    GatewayWriteResult:
      type: object
      required:
      - results
      properties:
        results:
          type: array
          items:
            type: object
            required:
            - requestId
            - revision
            - status
            properties:
              requestId:
                type: string
                minLength: 1
                maxLength: 120
                pattern: ^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$
              revision:
                type: integer
                minimum: 0
              status:
                type: string
                enum:
                - accepted
                - replay
                - stale
                - conflict
    GatewayMetrics:
      type: object
      required:
      - key
      - requests
      - errors
      - cancelled
      - pendingBilling
      - providerAttempts
      - providerErrors
      - traces
      - inputTokens
      - outputTokens
      - cachedTokens
      - reasoningTokens
      - costCovered
      - marginCovered
      - invoiceConfirmed
      - customerChargeNanos
      - knownProviderCostNanos
      - coveredMarginNanos
      - latency
      - firstToken
      - providerLatency
      properties:
        requests:
          type: integer
          minimum: 0
        errors:
          type: integer
          minimum: 0
        cancelled:
          type: integer
          minimum: 0
        pendingBilling:
          type: integer
          minimum: 0
        providerAttempts:
          type: integer
          minimum: 0
        providerErrors:
          type: integer
          minimum: 0
        traces:
          type: integer
          minimum: 0
        inputTokens:
          type: integer
          minimum: 0
        outputTokens:
          type: integer
          minimum: 0
        cachedTokens:
          type: integer
          minimum: 0
        reasoningTokens:
          type: integer
          minimum: 0
        costCovered:
          type: integer
          minimum: 0
        marginCovered:
          type: integer
          minimum: 0
        invoiceConfirmed:
          type: integer
          minimum: 0
        key:
          type: string
        customerChargeNanos:
          type: string
          pattern: ^-?[0-9]+$
          description: Integer USD nanodollars encoded as a string.
        knownProviderCostNanos:
          type: string
          pattern: ^-?[0-9]+$
          description: Integer USD nanodollars encoded as a string.
        coveredMarginNanos:
          type: string
          pattern: ^-?[0-9]+$
          description: Integer USD nanodollars encoded as a string.
        latency:
          type:
          - object
          - 'null'
          required:
          - samples
          - p50
          - p95
          - p99
          properties:
            samples:
              type: integer
              minimum: 0
            p50:
              type: integer
              minimum: 0
            p95:
              type: integer
              minimum: 0
            p99:
              type: integer
              minimum: 0
        firstToken:
          type:
          - object
          - 'null'
          required:
          - samples
          - p50
          - p95
          - p99
          properties:
            samples:
              type: integer
              minimum: 0
            p50:
              type: integer
              minimum: 0
            p95:
              type: integer
              minimum: 0
            p99:
              type: integer
              minimum: 0
        providerLatency:
          type:
          - object
          - 'null'
          required:
          - samples
          - p50
          - p95
          - p99
          properties:
            samples:
              type: integer
              minimum: 0
            p50:
              type: integer
              minimum: 0
            p95:
              type: integer
              minimum: 0
            p99:
              type: integer
              minimum: 0
  securitySchemes:
    gatewayBearer:
      type: http
      scheme: bearer
      bearerFormat: umxg_ followed by 64 lowercase hex characters
    collectorBearer:
      type: http
      scheme: bearer
      bearerFormat: UsageMax collector token (umx_ plus 64 lowercase hex characters)
    workosBearer:
      type: http
      scheme: bearer
      bearerFormat: WorkOS Connect JWT; delegated scopes enforced by the resource