AI Gateway

Meta Endpoint

GET /gateway/v1/meta/:requestId — per-request FinOps metadata fallback

The /meta endpoint is the fallback mechanism for retrieving per-request FinOps metadata (cost, provider, credits) when the final streaming SSE frame is missing or when you need to look up cost data after a non-streaming request has completed.

Endpoint

GET /gateway/v1/meta/:requestId

The requestId is the value returned in the Cova-Id response header (or the requestId field of the streaming cova frame). It must be a valid UUID v4.

Authentication

Required. Provide your CoreValue API key as a Bearer token:

Authorization: Bearer $COVA_API_KEY

Path Parameter Validation

The requestId must match the UUID v4 pattern:

/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i

A malformed requestId returns 400 Bad Request.

orgId-Scoped Storage

Metadata is stored in Redis under an orgId-scoped key: {orgId}:{requestId}. A separate global existence marker is stored at exists:{requestId}.

Cross-org access returns 404, not 403. This is intentional — returning 404 avoids confirming to a caller that a given requestId exists under a different organization.

Response Codes

StatusMeaningBody
200Metadata found under this orgIdCovaGatewayMeta JSON
202RequestId not found in the global marker — could be in-flight, expired (TTL), or never existed{ "status": "pending" }
404RequestId exists (global marker present) but not under this orgId
400Malformed requestId (not a UUID v4)

Metadata is stored for 300 seconds (5 minutes) after the request completes. After the TTL expires, lookups return 202.

When to Use It

Use /meta as a fallback when the final streaming SSE cova frame is missing — for example, when the upstream provider errored before the stream completed. The SDK's streamChat() yields an empty meta in that case and you should then call /meta to retrieve the cost.

Example

cURL

curl https://gateway.corevalue.dev/gateway/v1/meta/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer $COVA_API_KEY"

SDK

import { parseGatewayMeta } from "@cova/gateway";

const res = await fetch(
  "https://gateway.corevalue.dev/gateway/v1/meta/550e8400-e29b-41d4-a716-446655440000",
  { headers: { Authorization: `Bearer ${process.env.COVA_API_KEY}` } },
);

const meta = parseGatewayMeta(res.headers);

if (meta) {
  console.log(meta.requestCost);  // actual cost in USD
  console.log(meta.provider);     // provider that served the request
  console.log(meta.model);        // model that served the request
}
from cova_gateway import fetch_meta

meta = fetch_meta(
    "550e8400-e29b-41d4-a716-446655440000",
    api_key=os.environ["COVA_API_KEY"],
)

if meta:
    print(meta.request_cost)
    print(meta.provider)
    print(meta.model)

200 Response Body

{
  "requestId": "550e8400-e29b-41d4-a716-446655440000",
  "provider": "groq",
  "model": "groq/llama-3.1-70b-versatile",
  "status": "success",
  "requestCost": 0.0015,
  "estimatedCost": 0.023,
  "creditsRemaining": 48.77,
  "gatewayMode": "passthrough"
}

202 Response Body

{ "status": "pending" }

CovaGatewayMeta Fields

FieldTypeSource
requestIdstringCova-Id header
providerstringCova-Provider header
modelstringCova-Model header
status"success" | "error"Cova-Status header
requestCostnumber?Actual cost in USD
estimatedCostnumber?Upfront worst-case estimate
creditsRemainingnumber?Post-request credit balance (PTB only)
gatewayMode"passthrough" | "translated"?Cova-Gateway-Mode header
translationWarningstring?Dropped fields (only when translated)

On this page