GET/api/v1/generation

Get cost and tokens for one request

Looks up one settled request of your organization. The id is gen-<request_id>; the bare request id (the x-request-id response header) is also accepted. A request of another organization reads as unknown (404). streamed, finish_reason and generation_time are derived from recorded latency and terminal status. This 404 uses the {detail} envelope.

認証: AuthorizationヘッダーにBearer形式のAPIキー

クエリパラメータ

  • idstring必須

    Generation id (gen-<request_id>) or the bare request id.

レスポンス

  • 200

    The generation's metadata.

    レスポンス
    • dataobject必須
      data
      • idstring

        gen-<request_id>.

      • total_costnumber

        Charged credits plus the attributed estimate of your own provider key, USD.

      • usagenumber

        Same value as total_cost, USD.

      • modelstring

        Model slug as called.

      • provider_namestring

        Provider that served it; empty when nothing was dispatched.

      • streamedboolean

        True when a first token was observed.

      • cancelledboolean
      • finish_reasonstring | null

        stop for a completed request, else the failure class or status.

      • latencyinteger | null

        Total latency, ms.

      • generation_timeinteger | null

        Latency minus time to first token, ms.

      • tokens_promptinteger
      • tokens_completioninteger
      • native_tokens_promptinteger | null
      • native_tokens_completioninteger | null
      • native_tokens_reasoninginteger | null
      • native_tokens_cachedinteger | null
      • upstream_inference_costnumber | null

        List-price estimate of a request on your own provider key, USD; null for platform-funded requests.

      • cache_discountnumber | null

        Always null.

  • 401

    Missing, unknown or revoked API key.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 404

    No settled request of your organization has this id.

    レスポンス
    • detailstring必須
  • 422

    The body or query failed validation.

    レスポンス
    • detailarray<object>必須
      detail
      • typestring
      • locarray<string | integer>
      • msgstring

リクエスト

curl https://api.experientiallabs.ai/api/v1/generation?id=gen-req_7c1e4b2a9f0d4e3c8a51b6d2f0e9a734 \
  -H "Authorization: Bearer YOUR_API_KEY"

レスポンス

{
  "data": {
    "id": "gen-req_7c1e4b2a9f0d4e3c8a51b6d2f0e9a734",
    "total_cost": 0.004215,
    "usage": 0.004215,
    "model": "claude-opus-5.5",
    "provider_name": "anthropic",
    "streamed": true,
    "cancelled": false,
    "finish_reason": "stop",
    "latency": 6120,
    "generation_time": 5310,
    "tokens_prompt": 1840,
    "tokens_completion": 402,
    "native_tokens_prompt": 1840,
    "native_tokens_completion": 402,
    "native_tokens_reasoning": 0,
    "native_tokens_cached": 1024,
    "upstream_inference_cost": null,
    "cache_discount": null
  }
}

https://api.experientiallabs.ai/api/v1/generation?id=gen-req_7c1e4b2a9f0d4e3c8a51b6d2f0e9a734