Skip to content

[FR]: Support custom cost computation for models on Bedrock #2412

Open
@skarygia-te

Description

@skarygia-te

Proposal summary

I would like to be able to track cost for models on bedrock. For example this code snippet is currently only logging the number of tokens and not the cost:

from opik import track, opik_context @track(type="llm") # Note - Specifying the type is this is important def llm_call(input): opik_context.update_current_span( provider="bedrock", model="claude-3-5-sonnet-20240620-v1:0", usage={ "prompt_tokens": 4, "completion_tokens": 6, "total_tokens": 10 } ) return "Hello, world!" llm_call("Hello world!")

Motivation

The problem I am trying to solve is track costs of LLM requests while using LLM models on Bedrock

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions