fix(gateway): log initial requested model ID - #990
Conversation
Store and use the original llmgateway model ID (from user input) in log entries instead of the provider-specific rewritten model name. This ensures accurate logging and analytics. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
Queued actions:
|
WalkthroughAdds initialRequestedModel to capture the original modelInput and updates logging and response payloads in chat.ts to reference this value instead of requestedModel, preserving the original requested model name across routing/normalization. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
{apps/api,apps/gateway}/**/*.ts📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/{gateway,api}/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes logging to use the original llmgateway model ID instead of the provider-specific rewritten model name.
Changes
initialRequestedModelvariable to preserve the original user-provided model IDcreateLogEntry()calls (8 locations) to useinitialRequestedModelinstead ofrequestedModelProblem
Previously, when a user requested a model like "gpt-4o-mini" or "openai/gpt-4o-mini", the code would rewrite
requestedModelto the provider-specific model name (e.g., the actual model name used by the provider API). This rewritten value was then saved to the log table, making it difficult to track what the user originally requested.Solution
Now the original llmgateway model ID from user input is preserved in
initialRequestedModeland used for all logging purposes, whilerequestedModelcan still be used for provider-specific API calls.Test plan
pnpm format🤖 Generated with Claude Code
Summary by CodeRabbit