Skip to content

fix(provider): detect configured Cerebras endpoints#3

Open
NubsCarson wants to merge 1 commit into
devfrom
nubs/cerebras-compatible-endpoint-detection-20260520
Open

fix(provider): detect configured Cerebras endpoints#3
NubsCarson wants to merge 1 commit into
devfrom
nubs/cerebras-compatible-endpoint-detection-20260520

Conversation

@NubsCarson
Copy link
Copy Markdown
Member

@NubsCarson NubsCarson commented May 20, 2026

Issue for this PR

Follow-up to #2. Custom OpenAI-compatible provider configs can point at Cerebras through options.baseURL without declaring a provider/model api URL, which means the Cerebras reasoning replay normalizer cannot reliably identify the resolved endpoint.

Type of change

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

What does this PR do?

This PR makes configured custom endpoints visible to provider transforms and tightens Cerebras endpoint detection:

  • copies a custom provider's configured endpoint or baseURL into model.api.url when no model/provider api field is declared
  • detects Cerebras-compatible endpoints by parsing the configured URL hostname, not by matching arbitrary URL text
  • keeps the existing Cerebras reasoning replay behavior from Handle Cerebras reasoning replay fields #2 intact

This lets a user configure an OpenAI-compatible provider with baseURL: "https://api.cerebras.ai/v1" and still get the same reasoning replay cleanup as the dedicated @ai-sdk/cerebras provider.

How did you verify your code works?

  • bunx prettier --write src/provider/provider.ts
  • bun test --timeout 30000 test/provider/provider.test.ts test/provider/transform.test.ts -> 331 passed, 0 failed
  • bun run typecheck was checked; it still reports two current-dev baseline errors unrelated to this patch:
    • src/provider/transform.ts(19,38) missing OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX flag typing
    • test/acp/event-subscription.test.ts(11,30) missing ../../src/project/with-instance

Screenshots / recordings

Not a UI change.

Checklist

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6ac89175-9205-4764-a370-a508a313319f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nubs/cerebras-compatible-endpoint-detection-20260520

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Hey! Your PR title Detect configured Cerebras-compatible endpoints 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.

@NubsCarson NubsCarson changed the title Detect configured Cerebras-compatible endpoints fix(provider): detect configured Cerebras endpoints May 20, 2026
@github-actions
Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown

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

@NubsCarson
Copy link
Copy Markdown
Member Author

Status refresh (2026-05-22): the branch is still current against origin/dev (0 behind / 1 ahead) and the scoped provider tests for this patch pass locally.

Verified in a fresh scratch checkout of this PR:

  • bun install completed cleanly
  • bun --cwd packages/opencode test test/provider/provider.test.ts test/provider/transform.test.ts -> 331 pass, 0 fail

I also checked the broad root typecheck failure against plain origin/dev. bun run typecheck fails the same way on base, before this PR's single commit, with existing opencode package issues such as:

  • src/bus/global.ts typed EventEmitter override
  • missing Flag.OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX typing
  • @lydell/node-pty declaration resolution
  • missing test/acp/.../with-instance import

So the PR-specific provider/transform coverage is passing; the red broad/cancelled checks do not appear caused by the endpoint-detection diff.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant