Headers

Cova Header Directory

Complete guide to all Cova-* request and response headers

The CoreValue gateway uses Cova-* headers for request-side configuration and returns Cova-* headers on every response. Header matching is case-insensitive (the gateway lowercases header keys before comparison), but the canonical names below are recommended.

All examples below use the placeholder key sk-cova-XXXXXXXXXXXXXXXX and the gateway base URL https://gateway.corevalue.dev. Authentication is always Authorization: Bearer <COVA_API_KEY> — see Authentication.

Quick Reference

curl https://gateway.corevalue.dev/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-cova-XXXXXXXXXXXXXXXX" \
  -H "Cova-User-Id: user_abc123" \
  -H "Cova-Prompt-Id: prompt_42" \
  -H "Cova-Property-Region: us-east-1" \
  -H "Cova-Cache-Enabled: true" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.corevalue.dev/v1",
    api_key="sk-cova-XXXXXXXXXXXXXXXX",
)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}],
    extra_headers={
        "Cova-User-Id": "user_abc123",
        "Cova-Prompt-Id": "prompt_42",
        "Cova-Property-Region": "us-east-1",
        "Cova-Cache-Enabled": "true",
    },
)
import { OpenAI } from "openai";

const client = new OpenAI({
  baseURL: "https://gateway.corevalue.dev/v1",
  apiKey: "sk-cova-XXXXXXXXXXXXXXXX",
});

const response = await client.chat.completions.create(
  {
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: "Hello!" }],
  },
  {
    headers: {
      "Cova-User-Id": "user_abc123",
      "Cova-Prompt-Id": "prompt_42",
      "Cova-Property-Region": "us-east-1",
      "Cova-Cache-Enabled": "true",
    },
  },
);

Request Headers

All request headers use the Cova- prefix. They are extracted by the gateway middleware before the provider dispatch pipeline runs.

Cova-User-Id

DirectionRequest
PurposeEnd-user identifier for analytics, per-user rate-limit segments, and logging.
Validation[a-zA-Z0-9_\-:.], max 256 chars. Invalid values are treated as null (empty string in analytics).
ExampleCova-User-Id: user_abc123

Cova-Prompt-Id

DirectionRequest
PurposePrompt identifier for prompt-expansion and logging. Can also be set via body.prompt_id (the body value overrides the header).
Validation[a-zA-Z0-9_\-:.], max 256 chars. Same sanitizer as Cova-User-Id.
ExampleCova-Prompt-Id: prompt_42

Cova-Property-{Name}

DirectionRequest
PurposeArbitrary key-value metadata attached to the request for filtering, segmentation, and analytics. Multiple Cova-Property-* headers are allowed per request.
ValidationName: hyphens are converted to underscores, then [a-zA-Z0-9_], max 64 chars. Value: max 256 chars (truncated). Invalid names are silently dropped.
ExampleCova-Property-Region: us-east-1
curl https://gateway.corevalue.dev/v1/chat/completions \
  -H "Authorization: Bearer sk-cova-XXXXXXXXXXXXXXXX" \
  -H "Cova-Property-Region: us-east-1" \
  -H "Cova-Property-Env: production" \
  -H "Cova-Property-App: mobile" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hi"}]}'
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hi"}],
    extra_headers={
        "Cova-Property-Region": "us-east-1",
        "Cova-Property-Env": "production",
        "Cova-Property-App": "mobile",
    },
)
const response = await client.chat.completions.create(
  { model: "gpt-4o-mini", messages: [{ role: "user", content: "Hi" }] },
  {
    headers: {
      "Cova-Property-Region": "us-east-1",
      "Cova-Property-Env": "production",
      "Cova-Property-App": "mobile",
    },
  },
);

Cova-RateLimit-Policy

DirectionRequest
PurposeHeader-based bucket rate-limit policy. Overrides the DB-configured policy when present. Parsed into capacity / window / unit / segment.
ValidationMust parse via the gateway's parseRateLimitPolicyHeader(). Invalid values are ignored (falls back to DB policy).
ExampleCova-RateLimit-Policy: 100;window=60;unit=request;segment=user

Cova-Fallbacks

DirectionRequest
PurposeJSON array of model names to try in order if the primary model fails with a retryable status code.
ValidationValid JSON array, non-empty, max 5 elements, each a non-empty string. Invalid or missing → null (no fallback chain).
ExampleCova-Fallbacks: ["groq/llama-3.1-70b","together/meta-llama/Llama-3-70B"]

Cova-Cache-Enabled

DirectionRequest
PurposeEnables both cache read and write for this request.
Validation"true" (case-insensitive) → enabled. Any other value → disabled.
ExampleCova-Cache-Enabled: true

Cova-Cache-Save

DirectionRequest
PurposeEnables cache write only (store the response for future hits).
Validation"true" (case-insensitive) → enabled.
ExampleCova-Cache-Save: true

Cova-Cache-Read

DirectionRequest
PurposeEnables cache read only (serve from cache if a hit exists).
Validation"true" (case-insensitive) → enabled.
ExampleCova-Cache-Read: true

Cova-Cache-Bucket-Max-Size

DirectionRequest
PurposeMaximum number of cached responses per cache key (bucket size). Enables load-balancing across cached variants.
ValidationInteger, default 1, max 20. If greater than 20, cache settings return null (cache disabled).
ExampleCova-Cache-Bucket-Max-Size: 5

Cova-Cache-Seed

DirectionRequest
PurposeCache isolation seed. Prepended to the cache key hash to namespace cache entries (e.g. for A/B experiments).
ValidationAny string. Included in the SHA-256 cache key computation.
ExampleCova-Cache-Seed: my-experiment-v2

Cova-Cache-Ignore-Keys

DirectionRequest
PurposeJSON array of body keys to exclude from cache key computation (e.g. ignore user_id so different users share a cache entry).
ValidationValid JSON string array. Invalid JSON is ignored (no keys stripped).
ExampleCova-Cache-Ignore-Keys: ["user_id","timestamp"]

Cache-Control (the standard HTTP header) is also read by the cache middleware to determine TTL (s-maxage or max-age, max 365 days, default 7 days). It is not a Cova-* header but interacts with the cache subsystem.

curl https://gateway.corevalue.dev/v1/chat/completions \
  -H "Authorization: Bearer sk-cova-XXXXXXXXXXXXXXXX" \
  -H "Cova-Cache-Enabled: true" \
  -H "Cova-Cache-Bucket-Max-Size: 5" \
  -H "Cova-Cache-Seed: my-experiment-v2" \
  -H "Cova-Cache-Ignore-Keys: [\"user_id\",\"timestamp\"]" \
  -H "Cache-Control: max-age=3600" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hi"}]}'
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hi"}],
    extra_headers={
        "Cova-Cache-Enabled": "true",
        "Cova-Cache-Bucket-Max-Size": "5",
        "Cova-Cache-Seed": "my-experiment-v2",
        "Cova-Cache-Ignore-Keys": '["user_id","timestamp"]',
        "Cache-Control": "max-age=3600",
    },
)
const response = await client.chat.completions.create(
  { model: "gpt-4o-mini", messages: [{ role: "user", content: "Hi" }] },
  {
    headers: {
      "Cova-Cache-Enabled": "true",
      "Cova-Cache-Bucket-Max-Size": "5",
      "Cova-Cache-Seed": "my-experiment-v2",
      "Cova-Cache-Ignore-Keys": '["user_id","timestamp"]',
      "Cache-Control": "max-age=3600",
    },
  },
);

Legacy / Unsupported Request Headers

The following Cova-* headers were supported by the legacy Cloudflare Worker proxy and older gateway revisions. They are NOT read by the current gateway (gateway/src/) and sending them has no effect. They are listed here only so customers migrating from the Worker can confirm they are no longer needed.

Do not send these headers expecting gateway behavior. The current gateway ignores them. Use the supported request headers above instead.

HeaderLegacy purposeCurrent replacement
Cova-Retry-EnabledEnable per-request retriesRetries are env-configured server-side; see Error Handling
Cova-Retry-NumMax retry attemptsEnv-configured; observe X-Cova-Retry-Count response header
Cova-Retry-FactorBackoff multiplierEnv-configured
Cova-Retry-Min-TimeoutMin retry delayEnv-configured
Cova-Retry-Max-TimeoutMax retry delayEnv-configured
Cova-LLM-Security-EnabledPrompt-injection / PII scanNot supported by the current gateway
Cova-LLM-Security-AdvancedStricter security rulesNot supported by the current gateway
Cova-Moderations-EnabledPre-forward moderationNot supported by the current gateway
Cova-Token-Limit-Exception-HandlerCustom token-limit errorNot supported by the current gateway
Cova-Model-OverrideOverride request modelUse model in the request body or Cova-Fallbacks
Cova-Session-IdGroup requests into a sessionUse dashboard Sessions view; not a gateway request header
Cova-Session-PathSub-session pathDashboard feature; not a gateway request header
Cova-Session-NameSession nameDashboard feature; not a gateway request header
Cova-Omit-RequestOmit request body from logsNot supported by the current gateway
Cova-Omit-ResponseOmit response body from logsNot supported by the current gateway
Cova-Request-IdClient-supplied request IDThe gateway generates Cova-Id automatically
Cova-Posthog-KeyForward events to customer PostHogNot supported by the current gateway
Cova-Posthog-HostPostHog host URLNot supported by the current gateway
Cova-Target-UrlOverride upstream provider URLNot supported; use provider-prefix model routing
Cova-OpenAI-Api-BaseOverride OpenAI base URLNot supported; configure providers server-side

Response Headers

All response headers are set by the gateway on the response returned to the SDK client. They are assembled in buildResponseHeaders() and augmented after usage extraction.

Cova-Id

DirectionResponse
PurposeGateway-generated request ID (UUID). Used for log correlation and /meta endpoint lookups.
When SetAlways set on every gateway response (streaming + non-streaming). Also set on the forwarded upstream request.
ExampleCova-Id: 550e8400-e29b-41d4-a716-446655440000

Cova-Provider

DirectionResponse
PurposeThe provider that actually served the request (after fallback resolution). Reflects the key that was used, not the requested provider.
When SetAlways set.
ExampleCova-Provider: groq

Cova-Model

DirectionResponse
PurposeThe model that actually served the request (after fallback or budget-gate downgrade). May differ from the requested model.
When SetAlways set.
ExampleCova-Model: groq/llama-3.1-70b-versatile

Cova-Status

DirectionResponse
PurposeGateway-level status: "success" or "error". Derived from upstream HTTP status (200 → success, else → error).
When SetAlways set.
ExampleCova-Status: success

Cova-Request-Cost

DirectionResponse
PurposeActual cost in USD for this request, computed from extracted usage.
When SetNon-streaming: always set (even when 0) after usage extraction. Streaming: set in the final SSE cova frame (not as a header).
ExampleCova-Request-Cost: 0.0015000000

Cova-Request-Cost-Estimate

DirectionResponse
PurposeUpfront worst-case cost estimate (escrow reservation amount). UX hint only — not the source of truth.
When SetSet only when escrow is enabled and a PTB key may serve the request. All response types (streaming + non-streaming).
ExampleCova-Request-Cost-Estimate: 0.0230000000

Cova-Credits-Remaining

DirectionResponse
PurposePost-request credit balance in USD (pre-request balance − actual cost).
When SetPTB keys only, successful responses. Non-streaming: set as a header. Streaming: included in the final SSE cova frame and stored in /meta.
ExampleCova-Credits-Remaining: 48.7700000000

Cova-Gateway-Mode

DirectionResponse
PurposeWhether cross-provider translation was applied. "passthrough" (default) or "translated".
When SetAlways set. "translated" when CROSS_PROVIDER_TRANSLATION_ENABLED is on and the model prefix routes to a native provider (anthropic / google / bedrock).
ExampleCova-Gateway-Mode: translated

Cova-Translation-Warning

DirectionResponse
PurposeComma-separated list of request fields dropped during cross-provider translation.
When SetSet only when gatewayMode is "translated" and fields were dropped. Absent otherwise.
ExampleCova-Translation-Warning: logprobs,top_k

Cova-Cache

DirectionResponse
PurposeCache hit indicator. Set to "HIT" when the response is served from cache.
When SetSet only on cache hits (when Cova-Cache-Read or Cova-Cache-Enabled is true and a cached entry exists).
ExampleCova-Cache: HIT

Cova-Cache-Bucket-Idx

DirectionResponse
PurposeThe bucket slot index from which the cached response was served.
When SetSet only on cache hits.
ExampleCova-Cache-Bucket-Idx: 2

Cova-Cache-Latency

DirectionResponse
PurposeOriginal response latency (in ms) of the cached response, recorded when it was first stored.
When SetSet only on cache hits.
ExampleCova-Cache-Latency: 450

X-Cova-Retry-Count

DirectionResponse
PurposeNumber of retry attempts made before the request succeeded. Set by the retry executor for observability.
When SetSet when gateway-configured retries are enabled (env-configured server-side) and at least one retry was attempted. Absent on first-try success or when retries are disabled.
ExampleX-Cova-Retry-Count: 2

Streaming Final SSE Frame

When the gateway processes a streaming request, it appends one final SSE event after the upstream stream closes (including after data: [DONE] for OpenAI-format providers). The frame is appended by teeStream() in streaming.ts.

Exact Format

data: {"cova":{"requestId":"...","provider":"...","model":"...","status":"success","requestCost":0.0015,"creditsRemaining":48.77,"gatewayMode":"translated","translationWarning":"logprobs"}}

The frame is a single SSE data: line terminated by \n\n (two newlines). The JSON payload is nested under a "cova" key so the SDK can detect it by checking "cova" in lastChunk.

CovaGatewayMeta Shape

The shared contract between the TypeScript and Python SDKs (sdk/CONTRACT.md):

FieldTypeSource
requestIdstringCova-Id header
providerstringCova-Provider header
modelstringCova-Model header
status"success" | "error"Cova-Status header
requestCostnumber?Cova-Request-Cost (non-streaming) or final SSE event (streaming) or /meta endpoint
estimatedCostnumber?Cova-Request-Cost-Estimate (upfront, all responses)
creditsRemainingnumber?Cova-Credits-Remaining
gatewayMode"passthrough" | "translated"?Cova-Gateway-Mode
translationWarningstring?Cova-Translation-Warning (comma-separated list of dropped fields, only when translated)

In the streaming final SSE frame, requestCost is set only when usage.costUsd > 0. If no usage was extracted (e.g. upstream errored), the field is absent and the SDK should fall back to the /meta endpoint.

Retrieving Metadata After Streaming

For streaming requests, cost and credit fields are not available as response headers. Use the /meta endpoint to retrieve the CovaGatewayMeta after the stream completes:

curl https://gateway.corevalue.dev/gateway/v1/meta/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer sk-cova-XXXXXXXXXXXXXXXX"
import requests

resp = requests.get(
    "https://gateway.corevalue.dev/gateway/v1/meta/550e8400-e29b-41d4-a716-446655440000",
    headers={"Authorization": "Bearer sk-cova-XXXXXXXXXXXXXXXX"},
)
meta = resp.json()  # CovaGatewayMeta
const resp = await fetch(
  "https://gateway.corevalue.dev/gateway/v1/meta/550e8400-e29b-41d4-a716-446655440000",
  { headers: { Authorization: "Bearer sk-cova-XXXXXXXXXXXXXXXX" } },
);
const meta = await resp.json(); // CovaGatewayMeta

The /meta endpoint returns:

  • 200 — metadata found. Returns CovaGatewayMeta JSON.
  • 202 — requestId not found; may be in-flight, expired (TTL 5 min), or never existed. Returns { status: "pending" }.
  • 404 — requestId exists but belongs to a different organization.

Metadata TTL is 300 seconds (5 minutes) after the request completes. The requestId must be a valid UUID v4.

On this page