How to connect opencode to ollama cloud? #4808

Open
opened 2026-02-16 17:45:31 -05:00 by yindo · 3 comments
Owner

Originally created by @621625 on GitHub (Jan 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Hi guys,

Have you ever travelled the seven seas?

Do you know how to connect opencode to ollama cloud models? I get unauthorized error messages when I'm trying even though opencode.json looks correct.

Originally created by @621625 on GitHub (Jan 12, 2026). Originally assigned to: @rekram1-node on GitHub. Hi guys, Have you ever travelled the seven seas? Do you know how to connect opencode to ollama cloud models? I get unauthorized error messages when I'm trying even though opencode.json looks correct.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 12, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #4581: [FEATURE]: Ollama Cloud AUTH Login - discusses setup and authentication for Ollama Cloud
  • #6582: Ollama Cloud Models - covers connection and configuration of Ollama Cloud in OpenCode
  • #5344: OllamaError: Unable to connect - discusses connection issues with Ollama API keys

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 12, 2026): This issue might be a duplicate of existing issues. Please check: - #4581: [FEATURE]: Ollama Cloud AUTH Login - discusses setup and authentication for Ollama Cloud - #6582: Ollama Cloud Models - covers connection and configuration of Ollama Cloud in OpenCode - #5344: OllamaError: Unable to connect - discusses connection issues with Ollama API keys Feel free to ignore if none of these address your specific case.
Author
Owner

@621625 commented on GitHub (Jan 13, 2026):

Update:

I mean I want to connect to ollama cloud when using ollama run, not the TUI or desktop. So I edit the config file opencode.json and put this for example:

{
"$schema": "https://opencode.ai/config.json",
"model": "ollama-cloud/gpt-oss:20b-cloud",
"permission": {
"edit": "allow",
"bash": "allow",
"webfetch": "allow"
}
}

Looks simple enough. should work with opencode run -m ollama/gpt-oss:20b-cloud right? but not really. Sometimes it works, sometimes it doesn't. Am I missing something?

Also but I think this is another issue if i run that command in the .config/ollama folder then it - sometimes - works. But currently if i run it in another folder it doesn't work at all.

Also sometimes it seems like the same model is fast in the TUI but slow when using opencode run.

@621625 commented on GitHub (Jan 13, 2026): Update: I mean I want to connect to ollama cloud when using ollama run, not the TUI or desktop. So I edit the config file opencode.json and put this for example: { "$schema": "https://opencode.ai/config.json", "model": "ollama-cloud/gpt-oss:20b-cloud", "permission": { "edit": "allow", "bash": "allow", "webfetch": "allow" } } Looks simple enough. should work with opencode run -m ollama/gpt-oss:20b-cloud right? but not really. Sometimes it works, sometimes it doesn't. Am I missing something? Also but I think this is another issue if i run that command in the .config/ollama folder then it - sometimes - works. But currently if i run it in another folder it doesn't work at all. Also sometimes it seems like the same model is fast in the TUI but slow when using opencode run.
Author
Owner

@n-shamsi commented on GitHub (Jan 31, 2026):

Are you on Linux and installed opencode using npm? Try adding the npm line.

{
"$schema": "https://opencode.ai/config.json",
"model": ...,
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:11434/v1",
} ...

@n-shamsi commented on GitHub (Jan 31, 2026): Are you on Linux and installed opencode using npm? Try adding the npm line. > { "$schema": "https://opencode.ai/config.json", "model": ..., "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://localhost:11434/v1", } ...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4808