Skip to content

feat(vendors): add Cerebras as a model vendor - #12

Merged
lihe07 merged 1 commit into
respanai:mainfrom
sahilPadmani:feat/cerebras-vendor
Oct 20, 2026
Merged

lihe07 merged 1 commit into
respanai:mainfrom
sahilPadmani:feat/cerebras-vendor

Conversation

@sahilPadmani

@sahilPadmani sahilPadmani commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds Cerebras Inference as a yellow model vendor: vendor = "cerebras", Chat Completions at https://api.cerebras.ai/v1, key in CEREBRAS_API_KEY.

Fixes #4

What

  • crates/vendors/yellow/src/cerebras.rs, following deepseek.rs as the issue suggests, in both ALL lists.
  • Cerebras returns reasoning as reasoning, not DeepSeek's reasoning_content (reasoning guide, API reference), and takes it back in an assistant message as reasoning. With a straight copy, chat::read leaves delta.reasoning unread, so an Anthropic, Responses or Gemini client fails with untranslatable whenever the model reasons, and reasoning sent back in history goes as reasoning_content.
  • So its dialect renames delta.reasoning to reasoning_content before the existing chat::read, and the reasoning_content that chat::reasoning_written writes to reasoning. This is in cerebras.rs alone, as groq.rs and gemini.rs handle their quirks; the kit and the other vendors are unchanged.
  • Its top-level time_info needs nothing: openai-chat already treats it as inert.
  • Docs: a row in docs/vendors.md under Yellow and its base URL there, the vendor lists in docs/configuration.md and the README, and its LobeHub logo in docs/assets/vendors/ and the UI's vendor-icons.ts.

Checks

  • cargo fmt --all --check, cargo clippy --workspace --all-targets --all-features -- -D warnings: clean.
  • cargo test --workspace --all-targets --all-features: 631 passed; cargo test --workspace --doc --all-features: passed. a_bad_provider_is_an_error now lists cerebras.
  • apps/ui: pnpm lint, pnpm typecheck, pnpm test (196): pass.
  • Through the built binary against a local fake that answers as Cerebras's docs describe: OpenAI Chat, Anthropic, Responses and Gemini clients, streamed and not, all get the reasoning and the answer, and Cerebras receives reasoning sent back as reasoning. With a straight copy of deepseek.rs, every client but OpenAI Chat fails with untranslatable. I can share the fake if useful.
  • Against Cerebras's live API with a dummy key: /v1/chat/completions and /v1/messages both return Cerebras's own wrong_api_key, so the base URL, key header and routing are right. No live run with a real key.

Cerebras Inference speaks Chat Completions at https://api.cerebras.ai/v1,
its key in CEREBRAS_API_KEY. Its file follows deepseek.rs, but Cerebras
returns reasoning as `reasoning`, not `reasoning_content`, and takes it
back in an assistant message as `reasoning`. Its dialect renames the
field before `chat::read` and after `chat::reasoning_written`, so a
client of another format gets the reasoning instead of an untranslatable
response. The vendor kit and the other vendors are unchanged.

Fixes respanai#4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lihe07 lihe07 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sahilPadmani

sahilPadmani commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

The deny failure is RUSTSEC-2026-0383 (webpki-root-certs), published after main's last green run, so it also fails on main. It doesn't come from this change. cargo update -p webpki-root-certs -p rustls-webpki fixes it.

@lihe07

lihe07 commented Oct 20, 2026

Copy link
Copy Markdown
Member

The deny failure is RUSTSEC-2026-0383 (webpki-root-certs), published after main's last green run, so it also fails on main. It doesn't come from this change. cargo update -p webpki-root-certs -p rustls-webpki fixes it; happy to open a separate PR

sounds good. im merging this one first.

@lihe07
lihe07 merged commit 0a75161 into respanai:main Oct 20, 2026
18 of 19 checks passed
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.

Add Cerebras as a model vendor

2 participants