feat(types): expose USD cost/tier fields on CreditUsage - #202
feat(types): expose USD cost/tier fields on CreditUsage#202jeremyipark wants to merge 2 commits into
Conversation
Co-Authored-By: jeremy <jeremyparkphd@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Code Review
This pull request adds several optional fields (service_tier, mode_multiplier, standard_cost_dollars, cost_dollars, and savings_dollars) to the CreditUsage model in vlmrun/client/types.py to support new API payload fields. It also adds corresponding unit tests in tests/test_predictions.py to verify parsing, default values, and round-tripping within PredictionResponse. There are no review comments, and the changes look correct and well-tested.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
The VLM Run API returns per-request USD cost + service-tier info inside the
usageobject of prediction/execution responses (CreditUsageResponsein vlm-lab, populated invlm/infra/cloud/billing/usage.py), but the SDK'sCreditUsagemodel only declared the credit fields — so Pydantic silently dropped the dollar fields andresponse.usage.cost_dollarswas inaccessible.This adds the 5 wire fields to
CreditUsageso they round-trip:class CreditUsage(BaseModel): elements_processed: Optional[int] = None element_type: Optional[Literal["image", "page", "video", "audio"]] = None credits_used: Optional[int] = None steps: Optional[int] = None message: Optional[str] = None duration_seconds: int = 0 + service_tier: Optional[str] = None + mode_multiplier: Optional[float] = None + standard_cost_dollars: Optional[float] = None + cost_dollars: Optional[float] = None + savings_dollars: Optional[float] = NoneThese mirror exactly the non-excluded fields of the API's
CreditUsageResponse. The API'sinput_tokens/output_tokens/credit_cost_dollarsare intentionally not added — they areexclude=Trueon the server (internal-only, not on the wire).Applies to both
PredictionResponse.usageandAgentExecutionResponse.usage(both typed asCreditUsage).Test plan
tests/test_predictions.pycovering parse-from-payload, default-None, andPredictionResponseround-trip of the new fields.pytest tests/test_predictions.py tests/test_agent.py→ 79 passed.pre-commit run(ruff + black) → passed.Companion Node SDK PR: vlm-run/vlmrun-node-sdk (same fields on the
CreditUsageinterface).Link to Devin session: https://app.devin.ai/sessions/af66c3426c7f41188105bcaff4defc1b
Requested by: @jeremyipark