Skip to content

ProviderConfig.maxOutputTokens not applied to the request for a custom provider + unknown model #1627

@robsteen

Description

@robsteen

Summary

With @github/copilot-sdk@1.0.0 (@github/copilot CLI v1.0.59, protocolVersion 3), setting
ProviderConfig.maxOutputTokens for a custom OpenAI (BYOK) provider has no effect when the
model is not in the SDK's known-model-limits table. The value is accepted on the config but
never reaches the outbound request body, so output is not capped.

Environment

  • @github/copilot-sdk@1.0.0, @github/copilot CLI v1.0.59, protocolVersion 3
  • Custom OpenAI provider (BYOK relay):
    ProviderConfig = { type: 'openai', baseUrl: '…/v1/openai', wireApi: 'responses', apiKey, maxOutputTokens: 32000 }
  • Model: a custom Azure deployment (not a SDK-recognized model name)

What works

wireApi: 'responses' on the same ProviderConfig is honored — the CLI logs
Using custom provider … wireApi=responses and the outbound request is Responses-shaped
(instructions / input / text / reasoning).

Expected

max_output_tokens (Responses API) appears in the outbound request, capping output at 32000,
per the ProviderConfig.maxOutputTokens doc ("Overrides the resolved model's default max output tokens").

Actual

The outbound Responses request contains no max_output_tokens. Instrumentation confirms
provider.maxOutputTokens = 32000 is present on the session config immediately before
createSession() (alongside the wireApi that does take effect) — so the value reaches the SDK,
but the SDK does not emit it.

Likely cause

The request is built as roughly:

max_output_tokens: e.maxOutputTokens ?? <modelLimits>.max_output_tokens

The custom model isn't in the SDK's hard-coded limits map (the claude-* / gpt-5-mini / … table),
and ProviderConfig.maxOutputTokens doesn't appear to populate e.maxOutputTokens for a custom
provider — so the field is omitted entirely. This makes maxOutputTokens effectively a no-op for
any model the SDK doesn't already recognize.

Questions

  1. Should ProviderConfig.maxOutputTokens be honored for custom providers / models not in the
    SDK's known-limits table? Today it only seems to apply to recognized models.
  2. If not, what's the supported way to cap output tokens for a custom Azure deployment via the SDK,
    without a request-body/header shim?
  3. Does the same limitation apply to the wireApi: 'completions' path?

Happy to share instrumented logs or a minimal repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions