Skip to content

Feature/add bedrock cost tracking support #2843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

vladimirrotariu
Copy link
Contributor

@vladimirrotariu vladimirrotariu commented Jul 29, 2025

Summary

  • Adds Bedrock cost-tracking support
  • Preserves existing _bedrock provider string for compatibility

Resolves #1836
/claim #1836

Key Changes

Python SDK

  • Extended LLMProvider enum with BEDROCK = "_bedrock"
  • llm_usage_factory maps both:
    • LLMProvider.BEDROCK
    • Raw string "_bedrock"
      → to the Bedrock usage parser
  • Bedrock decorator now uses LLMProvider.BEDROCK
  • Unit test added: test_opik_usage_factory__bedrock_happyflow

Backend (Java)

  • CostService maps:
    • "_bedrock", "bedrock_converse""bedrock" for pricing
  • E2E test updates:
    • Includes Bedrock (normal + streaming) in SpansResourceTest#createAndGetCost

Docs

  • No changes needed — existing Bedrock guides already use _bedrock

Testing

  • Python: New unit test verifies Bedrock usage parsing
  • Backend: Existing E2E cost test cover Bedrock models (including streaming), added cost computation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR]: Add Bedrock provider for cost tracking
4 participants