Repository navigation
Docs for OpenAI Compatible providers like Cerebras #976
Description
I like how BAML does it - https://docs.boundaryml.com/ref/llm-client-providers/overview
This works for Programmatic SEO as well.
I wished the CLI had OpenAI Compatible option too or specific providers like Cerebras, Moonshot, and every new one. Kilo Code's team adds them extremely fast. That's one place to look at.
Also, search is not working well.
I did find https://opencode.ai/docs/models/ while writing this issue but took too long. I'm still confused where to put API Key for Open AI Compatible provider. Okay, I found it below baseUrl but for some reason, I can't set cerebras up.
I get this:
█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀
┌ Add credential
│
◇ Select provider
│ Other
│
◇ Enter provider id
│ cerebras
│
▲ This only stores a credential for cerebras - you will need configure it in opencode.json, check the docs for examples.
│
◇ Enter your API key
│ ▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪
│
└ Done
█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀
┌ Add credential
│
■ Select provider
│ Anthropic
│
And it loops again to asking for provider. This is my config on Mac at ~/.local/share/opencode/auth.json:
{
"$schema": "https://opencode.ai/config.json",
"autoupdate": false,
"model": "cerebras/qwen-3-235b-a22b",
"provider": {
"cerebras": {
"npm": "@ai-sdk/openai-compatible",
"name": "Cerebras",
"options": {
"baseURL": "https://api.cerebras.ai/v1",
"apiKey": "csk-something-something"
},
"models": {
"qwen-3-235b-a22b": {
"name": "Qwen-3-235b-a22b"
},
"qwen-3-32b": {
"name": "Qwen-3-32b"
},
"llama3.1-8b": {
"name": "Llama3.1-8b"
},
"llama-3.3-70b": {
"name": "Llama-3.3-70b"
},
"deepseek-r1-distill-llama-70b": {
"name": "Deepseek-r1-distill-llama-70b"
},
"llama-4-scout-17b-16e-instruct": {
"name": "Llama-4-scout-17b-16e-instruct"
}
}
},
"lmstudio": {
"npm": "@ai-sdk/openai-compatible",
"name": "LM Studio (local)",
"options": {
"baseURL": "http://127.0.0.1:1234/v1"
},
"models": {
"google/gemma-3n-e4b": {
"name": "Gemma 3n-e4b (local)"
}
}
}
},
"cerebras": {
"type": "api",
"key": "csk-something-something"
}
}I do think Cerebras should be top-level since it gives away lot of free stuff & its super duper fast.
Would love to know how to setup Cerebras properly? I am stuck in a loop.
Activity
deadcoder0904 commentedon Jul 14, 2025
Okay, I figured out how to run Cerebras but took me a while.
Another problem is global & local config. I had my global config & thought Opencode would use that but it didn't.
So I created
opencode.jsonin the root directory & pasted this:{ "$schema": "https://opencode.ai/config.json", "autoupdate": false, "model": "cerebras/qwen-3-235b-a22b", "provider": { "cerebras": { "npm": "@ai-sdk/cerebras", "name": "Cerebras", "options": { "baseURL": "https://api.cerebras.ai/v1", "apiKey": "csk-something-something" }, "models": { "qwen-3-235b-a22b": { "name": "Qwen-3-235b-a22b" }, "qwen-3-32b": { "name": "Qwen-3-32b" }, "llama3.1-8b": { "name": "Llama3.1-8b" }, "llama-3.3-70b": { "name": "Llama-3.3-70b" }, "deepseek-r1-distill-llama-70b": { "name": "Deepseek-r1-distill-llama-70b" }, "llama-4-scout-17b-16e-instruct": { "name": "Llama-4-scout-17b-16e-instruct" } } }, "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (local)", "options": { "baseURL": "http://127.0.0.1:1234/v1" }, "models": { "google/gemma-3n-e4b": { "name": "Gemma 3n-e4b (local)" } } } } }Another mistake I had was using
@ai-sdk/openai-compatibleinstead of@ai-sdk/cerebrasbecause in BAML, Cerebras was OpenAI Compatible so I used my muscle memory there.In any case, after doing this, I tried running
opencode& it worked. It should have read global file though if local didn't exist imo.Anyways, love this project (especially the UI) so can't judge on anything else but it needs the basics to be more easy so any noob can set it up instead of wasting 15-30 mins on this. I'll keep this open since it has many different suggestions that I think should be fixed.
ntovarsolorzano commentedon Jul 18, 2025
Lol, I came for the same reason. I was looking for a similar post so I may not rise a 'duplicated Issue'.
Have more than 2h... and I'm still trying to add Kimi-K2 into opencode 😭😭😭
It is openai-library compatible, should be easy. And indeed, the global and the local are different. I can make it into the local, but the idea is to add Kimi-K2 globally. I came across the same issues as the ones posted here.
So your 'solution' was to clone it locally and work with the local version?
Does it give you any issues by working in other directories?
My
opencode.jsonworks but only in locally, I can't make it work globally. Probably I am missing a simple step somewhere.Update: It works now! 😭🙌
I followed this advice
So I created opencode.json in the root directory & pasted this.rootdirectory is whatever folder you an in now, and you plan to work on. Also called 'project directory'.opencode.jsonin my case, I it is the sameopencode.jsonas in Github, but I added Kimi-K2.Thank you !!
jayair commentedon Jul 18, 2025
Yeah I think we should do something like the doc you linked to.
jayair commentedon Jul 30, 2025
Just added this doc: https://opencode.ai/docs/providers/
Going to start listing more providers as we go along
opencode-agent commentedon Jul 30, 2025
Created PR #1441
opencode session | github run
jayair commentedon Jul 31, 2025
I didn't ask for this PR but it's not bad wtf
Merge pull request anomalyco#976 from ymdvsymd/fix/ci-pnpm-yarn-compa…
fix den-v2 desktop auth handoff parity (anomalyco#976)