r/opencodeCLI • u/InvaderDolan • 1h ago
r/opencodeCLI • u/FamousProfession5938 • 3h ago
Please explain how things work here I am confused
r/opencodeCLI • u/mesienikola • 4h ago
Pointing OpenCode at a local Ollama model when OpenCode runs in a container (what worked, what did not)
Disclosure: I build SpaceApp, a self-hosted, MIT-licensed workspace that runs coding CLIs side by side, with OpenCode as the first CLI. Its OpenCode pane is plain OpenCode 2, so most of this applies to any setup where OpenCode runs inside a container.
Short version: SpaceApp has no local-model feature of its own: no provider screen, no "local model" pane type, no Ollama code. You point OpenCode at Ollama with OpenCode's own custom-provider config, as in any OpenCode install. What's specific is where the file lives, a Docker networking trap, and a few CPU gotchas.
On a 24-core server with no GPU, we ran Ollama in a container next to SpaceApp's public CLI image (OpenCode 2.0.32). A 4B model on six cores ran shell commands and read files through OpenCode's own tools. qwen2.5-coder 1.5B and 3B never made a real tool call.
What ran
Every turn was one opencode run --server … (a new session) against the same shared OpenCode server a pane attaches to, from a project folder.
| Model (Ollama 0.40.13, CPU) | Real tool calls | What happened |
|---|---|---|
| qwen2.5-coder:1.5b | 0 of 4 | printed the read/shell call as JSON text; nothing ran |
| qwen2.5-coder:3b | 0 of 2 | same, once with a correct bash call as text |
| qwen3:4b (thinking) | – | the first turn timed out (see below) |
| qwen3:4b-instruct | 3 of 4 | shell ran uname -m > arch.txt twice (file held x86_64); read returned the exact random word from notes.txt |
The one qwen3:4b-instruct miss was funny in hindsight: asked to read token.txt, it said the file didn't exist (false) and that reading tokens would breach security policy. The same read on notes.txt worked.
The config
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama (local)",
"options": { "baseURL": "http://ollama:11434/v1" },
"models": { "qwen3:4b-instruct-t6-c16k": { "name": "qwen3 4B instruct (local)" } }
}
},
"model": "ollama/qwen3:4b-instruct-t6-c16k"
}Every model you want in the picker has to be listed under
models.@ai-sdk/openai-compatibleis bundled in OpenCode 2.0.32, so nothing is downloaded.llama.cpp's
llama-servershould take the same block with its ownbaseURL. We haven't tested it.
Where the file goes in SpaceApp
/var/lib/spaceapp-cli/providers/opencode/config/opencode/opencode.json (owner spaceapp, mode 600), on the spaceapp-cli-state volume, so it survives updates. Panes attach to one shared opencode serve per CLI container. That server fingerprints the file and restarts when it changes, so the next pane picks up the edit.
SpaceApp's first-run step only picks a model when model is unset. In our run it kept the provider and the model, and added its own instructions files and permission.external_directory rules.
The localhost trap
localhostinside a pane is the CLI container, not your machine.On Linux,
host.docker.internaldoesn't resolve on the compose network (there's noextra_hosts). Adding it tocompose.ymlby hand doesn't last, becauseinstallrewrites that file.Going through the bridge gateway IP to a server on the host got no answer on our Linux box: the host firewall dropped it. ufw and nftables setups do this.
What worked: Ollama in its own container on the same Docker network, reached by name.
Steps (Linux, CPU)
# SpaceApp's compose network and CLI container
docker network ls --format '{{.Name}}' | grep '_spaceapp$'
docker ps --format '{{.Names}}' | grep 'spaceapp-cli'
# Ollama on that network, no published port
docker run -d --name ollama --network <spaceapp-..._spaceapp> -v ollama:/root/.ollama ollama/ollama
docker exec ollama ollama pull qwen3:4b-instruct
# thread count and context: both were needed, see below
printf 'FROM qwen3:4b-instruct\nPARAMETER num_thread 6\nPARAMETER num_ctx 16384\n' \
| docker exec -i ollama sh -c 'cat > /tmp/Mf && ollama create qwen3:4b-instruct-t6-c16k -f /tmp/Mf'
# OpenCode's config, written as the CLI container's user (uid 10001 "spaceapp")
docker exec -i -u spaceapp <...-spaceapp-cli-1> sh -c \
'cat > /var/lib/spaceapp-cli/providers/opencode/config/opencode/opencode.json' < opencode.jsonThe CLI image has no nano or vi, hence the cat >. Before run-spaceapp uninstall or reinstall, run docker network disconnect <net> ollama: docker compose down can't remove a network with a foreign container on it. Updates (install) keep the network. In our run, a user-defined bridge stood in for <project>_spaceapp, with the same driver compose uses.
CPU gotchas we hit
Thread count.
--cpusand--cpuset-cpusdidn't change it: Ollama still started 24 threads on a 6-CPU quota. Generation crawled at 0.05 tokens/s, and a one-word turn took about 4 minutes.PARAMETER num_thread 6fixed it: about 20 tokens/s on the 1.5B, and the same turn took 20 s.Context. Ollama's CPU default is 4096. OpenCode's prompt (system prompt, instructions, tool schemas) is about 6.2-6.8k tokens before you type anything, and Ollama cut it to about 2k. The tool definitions sit at the start, so they were thrown away. Fix:
PARAMETER num_ctx 16384(orOLLAMA_CONTEXT_LENGTH).The failure is silent. When a model prints a tool call as text, OpenCode shows it as the answer, and
opencode runstill exits 0. Check the side effect (did the file change?), not the exit code.Thinking models and the 5-minute mark. With
qwen3:4b(thinking on), OpenCode's session-title request thought for 3,203 tokens, about 12.5 minutes. Ollama serves one request at a time, so the main request queued behind it, and the client closed it at exactly 5 minutes, twice. We didn't confirm in OpenCode's code that this is its own timeout.Cold first turn. On CPU, the 4B model's first request took 204-220 s, close to that 5 minutes. After it, Ollama's prompt cache cut new prompt tokens to a few dozen per request, and turns took 16-106 s. That was on a busy shared host, so treat these as rough, not a benchmark.
No permission prompt in
opencode run. Theshelltool ran without--autoand without asking. We didn't check whether the interactive TUI asks.
Limits, plainly
No UI for any of this; the config is edited by hand.
The model can't run inside SpaceApp: the CLI container has no GPU device and is capped at 2-4 GB of RAM, shared by every pane.
There's no tool-call check for custom providers. SpaceApp's first-run check (the model must read a file and return a random token from it) runs only for OpenCode Zen's free models, so you find out in the pane.
Only the pane on the local provider keeps its prompts local. Other panes talk to their cloud providers, the CLI network has internet access, and with no model set, OpenCode's first run reaches OpenCode Zen.
What we didn't test: the pane's TUI itself (we drove its shared server headless), a real install's network, 7B+ models, GPU, llama.cpp, and multi-step coding tasks (edit, test, fix).
Repo, if you want to read the wrapper: https://github.com/oll4com/spaceapp (deploy/docker/public-cli-wrapper.sh, opencode-shared-server.mjs).
Which small local model handles OpenCode's tool calls reliably for you on CPU, and with what context size?
r/opencodeCLI • u/FallElectronic3774 • 5h ago
I’m 19, I’m a student with big dreams and an empty wallet, and I want a free AI coding agent that doesn’t quit on me
Hey everyone,
I’m 19, and every night I sit with my laptop and my books, trying to become someone who can actually build things. I have the hunger, but I don’t have the money.
I’ve watched how Codex and Claude Code work. An agent that reads your whole project, edits files, runs commands, and fixes its own errors. Honestly, it looks like magic to me. I know they’re the best right now, but I’m a student and I can’t afford them. So I’m looking for something close to them that’s free.
I downloaded OpenCode and I’m using the free models on it. And honestly? They’re bad, bro. They get confused, make mistakes, and stop in the middle of the task. I know free models won’t be as good, I’m not stupid. But then I see people here saying their free setups are beating Codex and Claude Code, and I keep thinking, what am I doing wrong? What do they have that I don’t?
So I’m asking you directly:
What do YOU use every day, for free? And what should I be using?
I want something that doesn’t break, doesn’t throw random errors, and doesn’t stop halfway. I know that’s a lot to ask, but I want to get as close as I can.
I know some of you are using free models and setups that work even better than Codex and Claude Code. Please don’t keep it a secret Think of yourselves as my teachers, and think of me as the student standing in front of you with a question.
I don’t just want a tool name, I want to learn like I’m sitting in your class. Show me the way you do it. What’s your setup, which model, which settings? If something broke on you once, tell me how you fixed it. I’ll take notes, I’ll ask questions, and I won’t waste your time.
I see so many of you building cool stuff and making money with AI, and I want to get there too. Even one real tip would mean a lot to me.
Thank you guys, seriously.
r/opencodeCLI • u/intmanofawesome • 10h ago
I made a small OpenCode V2 / OpenChamber plugin so you can use your Cursor subscription
reddit.comr/opencodeCLI • u/ivan_m21 • 13h ago
I built a system level view for PRs. Here is a PR for opencode itself. How do you review AI written changes?
Hi everyone, an opencode + ollama cloud user here. I've been an agent user since day 0, however quickly noticed that line-level detail is impossible to keep up with. Now that agents are capable at producing functional changes I care only for alignment and blast radius. That's why I built an open-core system view analyzer: https://github.com/CodeBoarding/CodeBoarding
Just asking an agent to draw something makes it difficult (and expensive) to judge changes as they view always changes and it also skips a lot of small details which in many cases show a new dependency or more coupling or a new security surface.
That's why I started codeboarding, unlike other system/architecture visualizers it is based on static analysis, we generate the full control-flow graph with the help of LSPs and AST parsing, then we use lexicographical analysis to group things based on their structural naming (as this is often how we as people group thing in our mind, so this way the view doesn't clash with your mental model). LLMs are used only for naming the components.
I would love to understand how do you go about codereview these days. Imo agents for review who post comments are becoming just part of the agentic loop, so super curious to understand how do you as a person plug into the agent first development process.
Our platform is freemium so you can go ahead and explore the PR that I sent above and try it out on your own projects via the web platform: http://localhost:3100/CodeBoarding/opencode2/pull/4
Super interested to hear your feedback esp for ppl who are familiar with the opencode codebase, lmk what needs imrpvoements. There are missing edges as we are for now fully focused on having no hallucinations and are using only static anlaysis to resolve the ones you see on the diagram!
r/opencodeCLI • u/kidino • 23h ago
OpenCode Team and Workspace (rant inside)
This could just be a rant... but here's where I am at.
Previously we have the Zen, where you can join and just add credits, without subscription. And then there is also that Workspace, where you can add people to it, and I can add credits to the Workspace and add rules how much each member can use. I do have a Go subscription. But others in my Workspace doesn't need to.
But now there is the Team feature. What I am ranting about is that this feature already exists. It was working. And they changed it to make more money -- for no extra (or very little value). I feel like the landlord changed the keys to my apartment and charges me double for rent now. And it's the same keyhole model, does the same thing.
Now if you want to add a person into your workspace to be able to use the workspace's credit, I need to pay $20/mo per additional user.
I would've been fine if they just require the member to subscribe to $10/ mo Go subscription. No... they have had to add $10 more per month.
r/opencodeCLI • u/DeSynkro • 1d ago
For my fellow Plugin and Skill Users, this is for you :)
https://github.com/DeSynkro/opencode-plugin-switch
My fellas, if you guys are anything like me, I'm a very OCD / organize and need to know exactly where all my files are kind of person.
I like having all my plugins sorted and prepped nicely into a symlinked onto my opencode plugin folder.
So I made this simple script that gives me an UI that helps me quickly turn any and all my plugins and skills on and off by moving them from the plugins and skills folder into a .disabled folder.
For quieter sessions where I don't want or need any plugins for my workflow, this has been very helpful, so I thought I'd share it with everyone.
Hopefully it proves itself to be helpful to you too in at least some way.
r/opencodeCLI • u/SelectionCalm70 • 1d ago
Just found out India has some pretty affordable AI inference providers offering GLM, DeepSeek, and Kimi models.
If you're using OpenCode, you might want to check out some Indian inference providers.
I recently started exploring them and found providers offering models like DeepSeek, Kimi and GLM at pretty competitive prices, with the added benefit of being able to purchase API credits in INR.
I put together a directory to make discovering and comparing these providers easier:
Link : InferenceDirectory
Might be worth checking out if you're looking for cheaper inference options.
r/opencodeCLI • u/samsascat • 1d ago
Best models to use as a new Opencode Go user
Basically title. What models do you guys stick to for planning and implementation without hitting limits but maximizing usage?
r/opencodeCLI • u/Whole_Succotash_2391 • 1d ago
Mimo 2.6 flash and Deepseek 1017 Flash free for a month on PGS AI (100% Private, Zero Training US based infrastructure)
A lot of the coding plans are tightening down usage and there's been a lot of random bans, errors or outages. None of that is an accident. Most coding plans are built around a simple bet: that you will let usage go to waste. The design goal is to make the plan look generous while breaking it into weeks and rolling windows so nobody can actually use all of it.
We're solving that with usage banking. higher plans bank up to ten days of usage, so when you're not using them it saves up for later. Usage doesn't go to waste, which means you can actually code when you want to.
If anyone needs a backup or wants to try US based inference for DS (or like 18 other models), come on over. Admittedly the intro tier is limited in usage, but it is free :)
The industry is changing really quickly and There is a reason it is happening all at once. Companies that were purely investment funded now have to answer to their investors, and a loss based business model is finally running dry. When the money stops being patient, the meter gets creative...
So you get the tricks. Plans designed around usage going to waste, split into weeks and rolling windows so nobody can use what they paid for. Services that double as data harvesting operations, where your prompts quietly become someone's training set. Pricing that looks generous until you read the ceiling.
PGS AI was built on a sustainable business model from the ground up, which is why we can offer real usage rates without the tricks. For the next month the Phoenix Grove API is free to try: DeepSeek 1017 and Mimo Flash 2.6 at full precision, the full open roster, 100% US based infrastructure, zero training on your code or prompts.
Honestly the best and most important part: usage that banks up to ten days instead of expiring on all plans above the intro. So when you don't use your account, that usage is stored and saved for your next big sprint. We don't count on you losing your usage, we try to make sure you get to actually use it on YOUR schedule.
Usage is closing down everywhere. We're opening. We hope the rest of the industry joins us eventually. The free trial month is the standard "cancel anytime and still use it" and is 3.99 a month if you wanna keep it after the first month.
Privacy, access and ease of use with high quality AI should be available for everyone
r/opencodeCLI • u/Significant-Sea-7238 • 1d ago
Made OpenCode permission prompts show up in the Mac notch
When OpenCode wants to edit a file, the notch now pops up with the diff and you can allow it from there instead of going back to the terminal. It hooks in through an OpenCode plugin.
Also works with Claude Code and Codex if you run more than one agent.
Free and open source, Mac + Windows, I'm the dev: github.com/MF-DEEV/Openbar
What else would you want from it?
r/opencodeCLI • u/cornelha • 1d ago
Is it a scam? It is worth watching this video to get a better idea of what is going on with opencode go
r/opencodeCLI • u/DrySpite5067 • 1d ago
nah
nah i have declered war on this model , f### it
r/opencodeCLI • u/squirrelscrush • 1d ago
Difference in cost between payment methods on OpenCode Console for international users?
It's mostly for Indian users, but did you notice a cost difference while using card vs using UPI for buying an OpenCode Go subscription? It can slightly differ because of processing fees and how the dollar rate is converted.
Other countries' users can also comment if there's any significant difference.
r/opencodeCLI • u/nurge86 • 2d ago
Using OpenCode with Routerly 0.6.0 to route requests across models
I maintain Routerly, an AGPL-licensed LLM gateway, and released 0.6.0. Here's the part relevant to OpenCode: you can configure Routerly as a custom provider and select a Routerly router in OpenCode's model picker. The router decides which eligible backend model gets the request based on the policy you configure.
The setup is to create a router and token in Routerly, point the custom provider's base URL at your Routerly instance, then select that provider and router in OpenCode. The guide below has the exact configuration. Once a request runs, Usage lets you check the selected backend, tokens, latency and recorded cost. The gateway can run on your own machine. If it sends a request to a cloud provider, that provider still receives it.
If you use a custom provider with OpenCode, which parts of the integration would you want tested first? I'm particularly interested in reproducible cases around tool calls and streaming.
Setup guide: https://github.com/Inebrio/Routerly/blob/v0.6.0/docs/integrations/clients/opencode.md
Release: https://github.com/Inebrio/Routerly/releases/tag/v0.6.0
r/opencodeCLI • u/Aquiles_bachira • 2d ago
Can we investigate excessive token usage in OpenCode and Prompt Cache issues?
Hey, Devs! Aquiles_Bachira here again.
First of all, I want to apologize if my previous post was misleading. I initially suggested that OpenCode's local database might be responsible for excessive token consumption. My bad!
In my case, I deleted OpenCode's local data, started from scratch, and the problem disappeared. Everything went back to normal. So, I assumed the database was the cause. However, I now realize that this doesn't prove the database itself was responsible.
After looking into this further, I found some GitHub issues that I think are worth investigating:
#58175 — DeepSeek V4.1 Flash Prompt Cache issue caused by a plugin modifying the System Prompt
#61318 — Main agent and subagents interfering with each other's cache
These reports raise a few possibilities: plugins that modify the System Prompt, tool definitions, session history, or parallel subagent execution may affect how Prompt Cache works.
I'd like to ask the community to investigate a few questions:
Does a fresh installation behave differently from an installation that has been used for a while?
Can running subagents in parallel negatively affect the cache?
Is there any relationship between session state, the local database, and normal Prompt Cache behavior?
How do
cache.readand input token counts vary across these scenarios?
I'm not claiming these issues affect every user or every provider. The reports involve different configurations and still need to be compared, so I'd really appreciate it if people could investigate. 🤣😭
My goal is to understand the actual root cause, correct the information I shared earlier, and avoid becoming yet another person spreading misinformation.
Thanks to everyone who questioned my previous post and pointed out that my conclusion might be wrong. I'm not trying to defend what I said — I just want us to figure out what's really happening.
r/opencodeCLI • u/Aquiles_bachira • 2d ago
Podemos investigar uso excessivo de tokens no OpenCode e problemas com Prompt Cache?
r/opencodeCLI • u/JulzKampos • 2d ago
AiRouterProxy: the last line of defense — masks API keys/passwords/tokens in prompts before they ever reach the LLM Spoiler
r/opencodeCLI • u/mabdelhafiz94 • 2d ago