Skip to content

[FEATURE]: Add query parameter support for custom OpenAI-compatible providers #7198

Closed

Description

@UranA1

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem:
When configuring custom OpenAI-compatible providers, there's currently no way to add query parameters to API requests. Some OpenAI-compatible APIs require query parameters (e.g., ?api-version=2024-01-01) rather than or in addition to headers for configuration.
Currently, the @ai-sdk/openai-compatible package only supports:

  • baseURL
  • apiKey
  • headers
  • fetch (custom function)

Use Case:
Some providers like Azure OpenAI Service variants or custom enterprise APIs require query parameters for:

  • API versioning (api-version)
  • Tenant/workspace identifiers
  • Feature flags or capabilities
  • Authentication tokens in query string format

Current Workaround:
The only workaround is implementing a custom fetch function that intercepts requests and manually appends query parameters, which is not straightforward or well-documented.

Proposed Solution:
Add a queryParams option to provider configuration:

{
  provider: {
    custom-provider: {
      npm: @ai-sdk/openai-compatible,
      api: https://api.example.com/v1,
      options: {
        apiKey: your-key,
        queryParams: {
          api-version: 2024-01-01,
          tenant: my-org
        }
      }
    }
  }
}

These parameters would be automatically appended to all requests made to the provider.

Benefits:

  • Cleaner configuration for APIs requiring query parameters
  • No need for custom fetch implementations
  • Consistent with how headers are already handled
  • Enables support for more OpenAI-compatible API variants

Implementation Location:
The change would likely need to be made in:

  • packages/opencode/src/provider/provider.ts (lines 892-975, where SDK options are processed)
  • packages/opencode/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts (where URLs are constructed)

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 7, 2026
  2. github-actions commented on Jan 7, 2026

    @github-actions
    Contributor

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

    Feel free to ignore if your feature request specifically requires query parameter support beyond what these issues address.

  3. Awowen commented on Jan 8, 2026

    @Awowen

    I'd like to work on this issue. Can I be assigned?

  4. rekram1-node commented on Jan 8, 2026

    @rekram1-node
    Contributor

    sure

  5. assigned and unassigned on Jan 8, 2026
  6. added a commit that references this issue on Jan 8, 2026
    b1234ce
  7. rsanchezc-pg commented on Feb 10, 2026

    @rsanchezc-pg

    @rekram1-node can this be reviewed, please? 🙏🏼

    #7375

  8. github-actions commented on Apr 12, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions