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
- 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.
- 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?
- Does the same limitation apply to the
wireApi: 'completions' path?
Happy to share instrumented logs or a minimal repro.
Summary
With
@github/copilot-sdk@1.0.0(@github/copilotCLI v1.0.59, protocolVersion 3), settingProviderConfig.maxOutputTokensfor a custom OpenAI (BYOK) provider has no effect when themodel 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/copilotCLI v1.0.59, protocolVersion 3ProviderConfig = { type: 'openai', baseUrl: '…/v1/openai', wireApi: 'responses', apiKey, maxOutputTokens: 32000 }What works
wireApi: 'responses'on the sameProviderConfigis honored — the CLI logsUsing custom provider … wireApi=responsesand 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.maxOutputTokensdoc ("Overrides the resolved model's default max output tokens").Actual
The outbound Responses request contains no
max_output_tokens. Instrumentation confirmsprovider.maxOutputTokens = 32000is present on the session config immediately beforecreateSession()(alongside thewireApithat does take effect) — so the value reaches the SDK,but the SDK does not emit it.
Likely cause
The request is built as roughly:
The custom model isn't in the SDK's hard-coded limits map (the
claude-* / gpt-5-mini / …table),and
ProviderConfig.maxOutputTokensdoesn't appear to populatee.maxOutputTokensfor a customprovider — so the field is omitted entirely. This makes
maxOutputTokenseffectively a no-op forany model the SDK doesn't already recognize.
Questions
ProviderConfig.maxOutputTokensbe honored for custom providers / models not in theSDK's known-limits table? Today it only seems to apply to recognized models.
without a request-body/header shim?
wireApi: 'completions'path?Happy to share instrumented logs or a minimal repro.