Skip to content

OpenAI GPT-5 verification fails in openshell inference set due to max_tokens request parameter #517

@kjw3

Description

@kjw3

Summary

openshell inference set works for older OpenAI chat-completions models like gpt-4.1, but verification fails for GPT-5-family models like gpt-5.4 because the validation request appears to send max_tokens, which OpenAI rejects for that model family.

Environment

  • OpenShell: 0.0.12
  • Host: macOS (Apple Silicon workstation)
  • Provider type: openai
  • Base URL: https://api.openai.com/v1

Reproduction

Provider setup succeeds:

export OPENAI_API_KEY=...
openshell provider create --name openai-api --type openai --credential OPENAI_API_KEY --config OPENAI_BASE_URL=https://api.openai.com/v1

This succeeds:

openshell inference set --provider openai-api --model gpt-4.1

Output:

Gateway inference configured:

  Route: inference.local
  Provider: openai-api
  Model: gpt-4.1
  Version: 1
  Validated Endpoints:
    - https://api.openai.com/v1/chat/completions (openai_chat_completions)

This fails:

openshell inference set --provider openai-api --model gpt-5.4

Output:

Error:   × failed to verify inference endpoint for provider 'openai-api' and model 'gpt-5.4' at 'https://api.openai.com/v1': upstream rejected the validation request with HTTP 400 Bad Request. Response body: {
  "error": {
    "message": "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.",
    "type": "invalid_request_error",
    "param": "max_token"

Expected behavior

openshell inference set --provider openai-api --model gpt-5.4 should validate successfully for supported OpenAI GPT-5-family models, or OpenShell should adapt the verification request to the model family requirements.

Actual behavior

Verification appears to send a request shaped for older chat-completions semantics (max_tokens), which GPT-5-family models reject.

Notes

  • This does not appear to be a provider creation problem.
  • The same provider and base URL work for gpt-4.1.
  • As a workaround, --no-verify can be used, but that is not ideal for normal onboarding flows.

Likely fix area

OpenShell inference endpoint verification for OpenAI provider/model combinations likely needs model-aware request shaping for GPT-5-family models, specifically around max_completion_tokens vs max_tokens.

Metadata

Metadata

Assignees

No one assigned

    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