-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Project
cortex
Description
Custom pricing via CORTEX_PRICING_<MODEL> cannot target provider/model names that include a slash (e.g., openai/gpt-4o). The env key is converted by replacing underscores with hyphens, producing openai-gpt-4o, which never matches openai/gpt-4o in session metadata. As a result, custom pricing is silently ignored for the most common model format.
Reference: cortex-cli/src/stats_cmd.rs load_custom_pricing().
Error Message
No error. The custom pricing is silently ignored.
Debug Logs
N/A
System Information
Bounty Version: 0.1.0
OS: Ubuntu 24.04 LTS
CPU: AMD EPYC-Genoa Processor (8 cores)
RAM: 15 GBScreenshots
No response
Steps to Reproduce
- Create a minimal session file at
~/.cortex/sessions/custom.json:{ "model": "openai/gpt-4o", "usage": {"input_tokens": 1000000, "output_tokens": 1000000}, "messages": [] } - Set custom pricing:
export CORTEX_PRICING_OPENAI_GPT_4O=1.0,1.0 - Run:
cortex stats --json - Observe that the estimated cost still reflects the default pricing, not the custom 1.0/1.0 override.
Expected Behavior
Custom pricing should apply to openai/gpt-4o when set via env var, or the docs/implementation should provide a reliable mapping for model names that include /.
Actual Behavior
The env key is converted to openai-gpt-4o, which never matches openai/gpt-4o, so custom pricing is ignored.
Additional Context
This affects all provider/model identifiers that include /, which is the primary naming format in Cortex.