Skip to content

Claude Opus 4.6 from Azure Foundry: Missing required max_tokens parameter causes 400 error in Copilot Chat and Playground #349

@cjmayoral

Description

@cjmayoral

BUG-REPORT-Claude-Opus-4-6.md

log-evidence-20260210-66888-ext.log

Description

When using claude-opus-4-6 model deployed via Azure AI Foundry in VS Code (both Copilot Chat and AI Toolkit Playground), all API calls fail with 400 error due to missing max_tokens parameter (required by Anthropic API).

The issue affects both user interfaces identically, indicating the bug is in the shared Azure Foundry integration layer, not UI-specific code.

Environment

  • OS: Windows 11
  • VS Code: Latest
  • AI Toolkit: v0.30.0-win32-x64
  • Model Source: Azure AI Foundry (eastus2_project)
  • Model: claude-opus-4-6

Steps to Reproduce

  1. Deploy claude-opus-4-6 to Azure AI Foundry
  2. Add model to AI Toolkit via "Add Model from Azure AI Foundry"
  3. Open Copilot Chat OR AI Toolkit Playground in VS Code
  4. Select claude-opus-4-6 from model dropdown
  5. Send any message (e.g., "Hello")

Expected Behavior

Model should respond successfully, with extension automatically including max_tokens parameter in API call (as required by Anthropic API documentation).

Actual Behavior

Immediate 400 error:

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "max_tokens: Field required"
  }
}

Log Evidence

From %USERPROFILE%\.aitk\<date>-ext.log:

Copilot Chat (10:11:36):

[2026-02-10T10:11:36.487Z] [ERROR] Unable to call the (cjmay-mid4rsyb-eastus2_project)claude-opus-4-6 inference endpoint due to 400.  Please check if the input or configuration is correct. 400 {"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: Field required"},"request_id":"req_011CXzD46UiQHMKZvTHe3B8Z"}

Playground (12:09:50):

[2026-02-10 12:09:50.113] [error] Unable to call the (cjmay-mid4rsyb-eastus2_project)claude-opus-4-6 inference endpoint due to 400.  Please check if the input or configuration is correct. 400 {"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: Field required"},"request_id":"req_011CXzHVdDKQ17gaveHHeuQJ"}

Comparison with Working Model

  • claude-opus-4-5: ✅ Works correctly in both Copilot Chat and Playground - extension includes max_tokens: 20000
  • claude-opus-4-6: ❌ Fails in both interfaces - extension omits required parameter

Both failures tested on 2026-02-10 with timestamps ~2 hours apart, confirming consistent behavior across interfaces.

Root Cause

The extension appears to have model-specific logic for constructing API calls to Azure Foundry. The code responsible for claude-opus-4-6 is missing the mandatory max_tokens parameter that opus-4-5 correctly includes.

Critical Finding: Both Copilot Chat and Playground fail identically, proving the bug is in the shared Azure Foundry integration layer, not in UI-specific implementations.

Workaround

Use claude-opus-4-5 instead (fully functional)

Impact

  • Blocks usage of latest Claude model in both Copilot Chat and Playground
  • 100% reproducible across all AI Toolkit interfaces
  • Affects all users with Azure Foundry + claude-opus-4-6
  • Forces users back to older model version (opus-4-5)

Additional Info

  • Full technical report available: [Attach BUG-REPORT-Claude-Opus-4-6.md]
  • Log file available: [Attach log-evidence-20260210-66888-ext.log]
  • User-editable configs (my-models.yml, foundry.modelinfo.json) do not control this behavior
  • Issue affects both Copilot Chat and Playground - confirmed with separate test cases
  • Bug is in the shared Azure Foundry model integration layer, not UI-specific code

Suggested Fix

Ensure all Claude model versions include max_tokens parameter in API calls, or add parameter validation to fail-fast with better error message.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions