GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(opencode): add ollama init cli command to generate opencode.json config dynamically by tobocop2 · Pull Request #4183 · anomalyco/opencode

Conversation

@tobocop2

@tobocop2 tobocop2 commented Nov 11, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Problem

Setting up opencode with ollama requires manually creating a config file and copying model names from ollama list. Unlike cloud providers that auto-configure through auth login, local providers like Ollama have no automated setup.

This is an alternative to #3726 but it is run conditionally by the user. I don't think opencode should look for ollama unless the user explicitly wants the support. My solution is an implementation of that and it's still configuration file driven. It is also thoroughly tested, cross platform and doesn't rely on an the arbitrary ollama base url and port but rather the ollama executable being found in the $PATH instead. I have been using a bash function to generate the opencode.json for me but I figured it would be helpful to others if this was just part of the opencode cli.

Run tests via

bun test test/cli/cmd/ollama.test.ts

Solution

Adds opencode ollama init to automatically generate config from installed models.

opencode ollama init -g                              # global config
opencode ollama init                                 # local config
opencode ollama init config.json --base-url <url>   # custom options

Key features:

  • Auto-discovers models from ollama list
  • --global flag writes to ~/.config/opencode/opencode.json
  • Merges with existing config (preserves other providers)
  • eliminates JSON syntax errors from manual configurations

Changes

  • New CLI command: src/cli/cmd/ollama.ts
  • Tests: test/cli/cmd/ollama.test.ts (9 tests)
  • Docs: Updated Ollama section in providers.mdx

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

josh-romer, s-haha-n, strk, and jellewijma reacted with heart emoji
All reactions
  • ❤️ 4 reactions
@tobocop2
tobocop2 force-pushed the add-ollama-command branch 3 times, most recently from eae5c72 to 857f6e0 Compare November 11, 2025 03:15
@tobocop2 tobocop2 changed the title Add ollama init command to auto-generate config Add ollama init command to auto-generate opencode.json config Nov 11, 2025
@tobocop2 tobocop2 changed the title Add ollama init command to auto-generate opencode.json config feat: Add ollama init command to auto-generate opencode.json config Nov 11, 2025
@tobocop2 tobocop2 changed the title feat: Add ollama init command to auto-generate opencode.json config feat: add ollama init command to auto-generate opencode.json config Nov 11, 2025
@tobocop2
tobocop2 force-pushed the add-ollama-command branch 4 times, most recently from 747523f to 837b42e Compare November 11, 2025 22:15
@tobocop2 tobocop2 changed the title feat: add ollama init command to auto-generate opencode.json config feat: add ollama init cli command to generate opencode.json config dynamically Nov 11, 2025
@tobocop2 tobocop2 changed the title feat: add ollama init cli command to generate opencode.json config dynamically feat(cli): add ollama init cli command to generate opencode.json config dynamically Nov 11, 2025
@tobocop2
tobocop2 force-pushed the add-ollama-command branch from 837b42e to 1ab4fd0 Compare November 12, 2025 00:01
@tobocop2
Introduce ollama config generation command
0b8160a
@tobocop2
tobocop2 force-pushed the add-ollama-command branch from 1ab4fd0 to 0b8160a Compare November 12, 2025 00:05
tobocop2 and others added 6 commits November 17, 2025 16:46
@tobocop2
Merge branch 'dev' into add-ollama-command
291d7a4
@tobocop2
Merge branch 'dev' into add-ollama-command
a946910
@tobocop2
Merge branch 'dev' into add-ollama-command
a92ca08
@actions-user
chore: format code
ce21ae4
@tobocop2
Merge branch 'dev' into add-ollama-command
729b643
@actions-user
chore: format code
7e5bac7
@github-actions
github-actions Bot force-pushed the dev branch 3 times, most recently from f1dc981 to 3e15a39 Compare November 22, 2025 18:07
@thdxr
thdxr force-pushed the dev branch from 3e15a39 to a0831ea Compare November 22, 2025 18:11
@github-actions
github-actions Bot force-pushed the dev branch 3 times, most recently from f8ee907 to 6a9856d Compare November 27, 2025 01:29
@tobocop2
Merge branch 'dev' into add-ollama-command
5ecd8d4
@rekram1-node
rekram1-node force-pushed the dev branch from 398b39a to 5013d64 Compare December 5, 2025 05:13
@tobocop2
Merge branch 'dev' into add-ollama-command
a768476
@github-actions github-actions Bot added the needs:title label Jan 8, 2026
@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title feat(cli): add ollama init cli command to generate opencode.json config dynamically 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tobocop2 tobocop2 changed the title feat(cli): add ollama init cli command to generate opencode.json config dynamically feat(opencode): add ollama init cli command to generate opencode.json config dynamically Jan 8, 2026
@tobocop2
Merge branch 'dev' into add-ollama-command
fe52700
@tobocop2 tobocop2 closed this Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:title

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@tobocop2 @actions-user
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.