Repository navigation
馃摗 fix: Respect Custom Endpoint Stream Usage Opt-In - #13237
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes agent run configuration for OpenAI-compatible custom endpoints so that streamUsage is only forced off when there is no explicit endpoint/model opt-in, preserving explicit streamUsage values while keeping the existing compatibility default.
Changes:
- Detect explicit
streamUsagepresence in resolved model parameters and avoid overriding it for OpenAI-compatible custom endpoints. - Preserve existing compatibility behavior by defaulting
streamUsagetofalsefor custom/OpenAI-compatible endpoints when not explicitly set. - Add targeted unit tests covering the default-disable path and the explicit opt-in path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/api/src/agents/run.ts |
Only disables streamUsage for custom/OpenAI-compatible endpoints when it wasn鈥檛 explicitly provided via model parameters. |
packages/api/src/agents/__tests__/run-summarization.test.ts |
Adds tests ensuring default streamUsage=false for OpenAI-compatible custom endpoints and honoring explicit streamUsage=true. |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GitNexus: 馃殌 deployedThe |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! 鈩癸笍 About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 馃憤. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Revert in-place fork edit to packages/api/src/agents/run.ts and use upstream's new model_parameters.streamUsage opt-in (PR LibreChat-AI#13237) instead. A fork-only helper sets streamUsage=true on LiteLLM-endpoint agents (walking subagentAgentConfigs recursively) before createRun runs, so upstream code stays vanilla and cost-breakdown behavior on LiteLLM is preserved.
Summary
I fixed custom/OpenAI-compatible agent runs so an explicit endpoint
streamUsageopt-in survives the compatibility default.streamUsagewhen endpoint-resolved model parameters explicitly define it.createRuntests for the default behavior and the explicit opt-in path.Change Type
Testing
NODE_PATH=/Users/danny/Projects/LibreChat/node_modules /Users/danny/Projects/LibreChat/node_modules/.bin/jest src/agents/__tests__/run-summarization.test.ts --runInBand --coverage=falsefrompackages/api.Test Configuration:
packages/apiChecklist