Skip to content

feat(opencode): use regex to whitelist/blacklist provider models#23283

Open
flexdinesh wants to merge 1 commit intoanomalyco:devfrom
flexdinesh:regex-provider-blacklist-whitelist
Open

feat(opencode): use regex to whitelist/blacklist provider models#23283
flexdinesh wants to merge 1 commit intoanomalyco:devfrom
flexdinesh:regex-provider-blacklist-whitelist

Conversation

@flexdinesh
Copy link
Copy Markdown

@flexdinesh flexdinesh commented Apr 18, 2026

Issue for this PR

Closes #18326

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR adds the ability to use regex patterns to whitelist/blacklist provider models in the config.

Before:

  "provider": {
    "opencode": {
      "blacklist": [
        "claude-3-5-haiku",
        "claude-haiku-4-5",
        "claude-opus-4-1",
        "claude-opus-4-5",
        "claude-opus-4-6",
        "claude-sonnet-4",
        "claude-sonnet-4-5",
        "claude-sonnet-4-6",
        "glm-4.6",
        "glm-4.7",
        "glm-4.7-free",
      ],
    },

Now:

  "provider": {
    "opencode": {
      "blacklist": [
        "/claude/", // all claude models
        "/glm-4(\\..*)?$/", // all glm 4.x models
      ],
    },

How did you verify your code works?

I updated my config, ran the code in my local using bun dev and verified that the regex patterns in blacklist/whitelist in opencode.json file are getting picked up.

Screenshots / recordings

Zen models before the change:

CleanShot 2026-04-18 at 21 26 41@2x

Zen models after the change (claude models are now hidden):

CleanShot 2026-04-18 at 21 27 18@2x

Config:

CleanShot 2026-04-18 at 21 23 36@2x

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions github-actions bot added needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Apr 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title Use regex to whitelist/blacklist provider doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

Related PR:

However, this is not an exact duplicate as PR #23283 specifically adds regex pattern support to the existing whitelist/blacklist functionality, while #18899 focuses on an enable/disable configuration field.

No other duplicate PRs were found that directly address the same regex whitelist/blacklist feature.

@flexdinesh flexdinesh changed the title Use regex to whitelist/blacklist provider feat(config): use regex to whitelist/blacklist provider Apr 18, 2026
@flexdinesh flexdinesh changed the title feat(config): use regex to whitelist/blacklist provider feat(opencode): use regex to whitelist/blacklist provider Apr 18, 2026
@flexdinesh flexdinesh changed the title feat(opencode): use regex to whitelist/blacklist provider feat(opencode): use regex to whitelist/blacklist provider models Apr 18, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Allow pattern-matching for provider blacklist/whitelist in config

1 participant