Skip to content

Using OpenAI via Cloudflare AI Gateway results in Unsupported parameter error. #22374

Closed

Description

@kobicovaldev

Description

When using /models to pick a GPT model like GPT-5.4 or some other modern OpenAI model you get the following result from any prompt: Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.

If you use an older GPT model like GPT-4o does work. I think this has to do with "OpenAI officially switched to max_completion_tokens in September 2024 to coincide with the release of the o1 series models"

Curious if there is a plan to fix or a best workaround.

Plugins

No response

OpenCode version

1.3.10

Steps to reproduce

After making sure you set up Cloudflare AI Gateway and a model like Claude Opus 4.6 works

  1. opencode
  2. /models
  3. GPT-5.4 Cloudflare AI Gateway
  4. Get error.

Screenshot and/or share link

Image

Operating System

macOS 26.4.1

Terminal

macos terminal

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 14, 2026
  2. github-actions commented on Apr 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. lorenjphillips commented on Apr 15, 2026

    @lorenjphillips

    +1 Good Issue

    I had this issue as well, would be great to have it addressed!

  4. kobicovaldev commented on Apr 16, 2026

    @kobicovaldev
    ContributorAuthor

    #22864 @rekram1-node maybe this will work or something similar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions