Skip to content

[Bug] Unsupported parameter: 'max_tokens' instead of 'max_completion_tokens'. #10787

Closed

Description

@NikolaHajdin

name: Unsupported parameter
about: Report a problem with the Unsloth Studio desktop app
title: "[Bug] Unsupported parameter: 'max_tokens' instead of 'max_completion_tokens'."
labels: bug, feature request
assignees: ""

Environment

Where are you using Unsloth?

  • Unsloth desktop application
  • Unsloth web UI (unsloth studio)
  • Unsloth CLI
  • Python package or notebook
  • Colab or Kaggle

Operating system and version:

GPU model(s) and accelerator backend: Connection (not applicable)

Versions:
Unsloth Version: v0.1.808-beta
Package Version: 2026.9.4
Desktop App Version: 0.1.808-beta
llama.cpp Version: b10840-mix-d5c17a0

What happened?

Steps to reproduce:

  1. Connect to a ChatGPT-5 model that uses 'max_completion_tokens' or 'maxOutputTokens'
  2. Confirm all models are loaded
  3. Test and get sad

Expected behavior:
Response

Actual behavior:
Error message, see below.

Model and operation involved:
Model: gpt-5.5
Operator: Microsoft Azure

Diagnostics and logs

Full error: Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. (unsupported_parameter)

10:12:04 [INFO] [backend] {"timestamp": "2026-09-11T10:12:04.323074Z", "level": "info", "event": "Proxying chat completion to https://chat.kiconnect.nrw/api/v1/chat/completions (provider=custom, model=GPT5-Mitarbeitende)"}
10:12:04 [INFO] [backend] {"timestamp": "2026-09-11T10:12:04.804473Z", "level": "error", "event": "External provider returned 400: {\n  \"error\": {\n    \"message\": \"Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"max_tokens\",\n    \"code\": \"unsupported_parameter\"\n  }\n}"}

Comparable configuration

In github copilot in VS Code this JSON config is fully functional.

{
	"name": "KI:connect",
	"vendor": "customendpoint",
	"apiKey": "${REDACTED}",
	"apiType": "chat-completions",
	"models": [{
		"id": "GPT5-Mitarbeitende",
		"name": "KI:connect — GPT5-Mitarbeitende",
		"url": "https://chat.kiconnect.nrw/api/v1/chat/completions",
		"toolCalling": true,
		"vision": false,
		"maxInputTokens": 120000,
		"maxOutputTokens": 8000,
		"streaming": true,
		"modelOptions": {
			"temperature": 1
		}
	}, ....

Activity

  1. added
    feature request
    on Sep 11, 2026
  2. added 2 commits that reference this issue on Sep 12, 2026
    a4a0af2
    47b0b20
  3. devtyagi3909 commented on Sep 18, 2026

    @devtyagi3909

    yeah this is because the backend explicitly hardcodes max_tokens when packing the custom provider payload, but newer endpoints (like o1 and apparently your mock gpt-5) enforce the newer max_completion_tokens standard. the client config allows passing it, but it gets eaten or mismapped before the request fires. we should probably just normalize max_tokens to max_completion_tokens during the proxy build step for those providers. i can prototype the fix if you agree.

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

    bugfeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions