Skip to content

AI Gateway: Bedrock Converse API responses missing token usage and cost tracking #29783

@Big-Tree

Description

@Big-Tree

Description

When routing AWS Bedrock requests through the AI Gateway, token usage and cost aren't tracked in the dashboard. Requests log correctly (status, model, latency), but usage shows "– in / – out" and cost shows "$ –".

Cause

The Bedrock Converse API returns usage in camelCase, but the gateway only appears to parse snake_case fields:

Bedrock response:

{
  "usage": {
    "inputTokens": 13,
    "outputTokens": 12,
    "totalTokens": 25
  }
}

OpenAI response (tracked correctly):

{
  "usage": {
    "input_tokens": 761,
    "output_tokens": 3441,
    "total_tokens": 4202
  }
}

Steps to Reproduce

  1. Route Bedrock requests through AI Gateway using the documented URL rewriting approach
  2. Make a request to any Bedrock model (e.g. Claude Sonnet 4.6)
  3. Check the AI Gateway logs — tokens and cost are missing

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions