Skip to content

Conversation

@alexmojaki
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Docs Preview

commit: db33309
Preview URL: https://bfa2b66e-pydantic-ai-previews.pydantic.workers.dev

@alexmojaki alexmojaki requested a review from Copilot October 9, 2025 09:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extracts OpenAI usage information using the "genai-prices" library. The changes update the usage mapping functionality to work with genai-prices for better token cost calculation and tracking.

  • Update genai-prices dependency to version 0.0.31
  • Refactor _map_usage function to use RequestUsage.extract() method from genai-prices
  • Add base_url parameter tracking for provider URL identification

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
pydantic_ai_slim/pyproject.toml Bump genai-prices dependency from 0.0.30 to 0.0.31
pydantic_ai_slim/pydantic_ai/models/openai.py Refactor usage mapping to use genai-prices extraction with provider URL tracking
tests/models/mock_openai.py Add base_url field to mock OpenAI classes for testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@alexmojaki alexmojaki requested a review from DouweM October 9, 2025 10:03
@alexmojaki alexmojaki enabled auto-merge (squash) October 20, 2025 10:30
@alexmojaki alexmojaki merged commit c5b1495 into main Oct 20, 2025
27 checks passed
@alexmojaki alexmojaki deleted the alex/extract-usage-openai branch October 20, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants