Skip to content

support extra request params for byok model #3448

Description

@lictex

Describe the feature or problem you'd like to solve

some llm providers might require additional nonstandard request parameters for certain features or tweaks

Proposed solution

env var COPILOT_EXTRA_REQUEST_PARAMS='{"abc": "def"}'
so {"abc": "def"} will be appended to the llm request body
similar features seems also exist in various other agent frameworks

Example prompts or workflows

No response

Additional context

No response

Activity

  1. added theissue type on May 21, 2026
  2. ZzetT commented on May 21, 2026

    @ZzetT

    Is this similar to what I described in #3399?

  3. added
    area:models
    area:configuration
    on May 21, 2026
  4. lictex commented on May 21, 2026

    @lictex
    Author

    Is this similar to what I described in #3399?

    y quite similar but this is for request body instead of headers

  5. doggy8088 commented on Oct 21, 2026

    @doggy8088

    A concrete use case for this feature is requesting token usage from a streaming OpenAI-compatible BYOK endpoint:

    {
      "stream": true,
      "stream_options": {
        "include_usage": true
      }
    }

    For providers that require this opt-in, omitting stream_options.include_usage means the response stream does not contain token usage. That prevents clients from obtaining actual input/output token counts from that response and makes usage monitoring harder. Custom HTTP headers would not solve this, because the option belongs in the JSON request body.

    There is also evidence that some CLI paths already include it:

    Those are other users' captures, not a reproduction of a missing-field bug. They suggest the first step should be to establish whether inclusion is already intended across all streaming Chat Completions BYOK paths, and whether omissions depend on version, provider configuration, or request type.

    For implementation, I would suggest separating two concerns:

    1. Consistent usage reporting: Include stream_options.include_usage: true by default for streaming Chat Completions requests where supported. Make sure the streaming parser accepts a final usage-only chunk with an empty choices array, retains its usage, and exposes the counts through the existing usage reporting/events.

    2. Provider-specific request options: Add a documented way to merge extra JSON body parameters per provider, with clear precedence and nested-object merge behavior. For example, the environment variable proposed in this issue could express:

      # Proposed syntax; not an existing supported setting.
      export COPILOT_EXTRA_REQUEST_PARAMS='{"stream_options":{"include_usage":true}}'

    A documented provider-level override would also help with endpoints that reject this option. It should not be injected indiscriminately into Responses or Anthropic Messages requests: related proxy bugs show that doing so can cause HTTP 400 errors (github/gh-aw-firewall#3804, github/gh-aw-firewall#7201).

    Useful regression coverage would include OpenAI-compatible and Azure Chat Completions requests, preservation of other stream_options fields, propagation of usage from the final SSE chunk, and exclusion of this Chat Completions option from the other wire protocols.

    Is the automatic inclusion shown in those captures the intended behavior for all streaming Chat Completions BYOK requests? If so, documenting that guarantee and providing a provider-specific override would help distinguish a regression from a configuration limitation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configurationarea:models

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions