opencode-ollama-provider-setup
БесплатноБез исполняемых скриптовНе проверенAdd an Ollama-hosted model (local laptop or a remote box like the GB10) as a usable model/provider in opencode, and verify it end-to-end. Use when the user…
от ericmjl★ 45 звёзд на GitHubОб этом скилле
Opencode Ollama Provider Setup
Verified recipe for adding an Ollama-served model to opencode as a
provider, plus the smoke-test gotchas that waste turns when skipped.
Do NOT re-derive it from docs — every step is verified-working on this
machine (worked example: 2026-08-15, adding muse-glimmer:latest
[18 GB / 27.9B / Q4_K_M / 131072 ctx / tools + thinking] as provider
ollama-local; earlier: 2026-02-15 llama3:8b, 2026-06-10 ollama-gb10).
Instructions
Step 1: Get the exact model tag
ollama list
The config key must EXACTLY match the tag (muse-glimmer:latest, with
the :latest suffix if that is how it is listed).
Step 2: Verify the OpenAI-compatible endpoint
curl -s http://127.0.0.1:11434/v1/models
The model must appear in the response. For a REMOTE box (GB10 etc.),
use its Tailscale hostname/IP instead of 127.0.0.1 — see the
ollama-gb10 provider entry for the pattern and the
ollama-on-gb10-dgx-spark skill for OLLAMA_HOST setup.
Step 3: ollama show — context length AND the tools gate
ollama show <model-tag>
- Context length (e.g. 131072) → use as
limit.context. - Capabilities → MUST include
tools. A model withouttoolscannot make agentic tool calls and will NOT work as an opencode coding agent, no matter how good it is at chat. (visionandthinkingare bonuses.) Note whether it is a thinking model — matters for the smoke test below.
Step 4: Add the provider block to ~/.config/opencode/opencode.json
Mirror the existing ollama-gb10 / ollama-local pattern:
"ollama-local": {
"models": {
"muse-glimmer:latest": {
"limit": { "context": 131072, "output": 65536 },
"name": "Muse Glimmer 28B (local)"
}
},
"name": "Ollama (local)",
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "http://127.0.0.1:11434/v1" }
}
- The
modelsmap key is the OLLAMA TAG verbatim; the label lives inname. Additional models on the same server go under the same provider'smodelsmap — no second provider block. npmis@ai-sdk/openai-compatible— opencode installs it on demand.- Prefer
127.0.0.1overlocalhostin the baseURL. output: 65536matches the house convention; it is a cap, not a requirement.
Step 5: Validate JSON, then restart opencode
python -m json.tool ~/.config/opencode/opencode.json > /dev/null && echo OK
opencode reads provider config at STARTUP — quit and restart; the new
provider will not hot-appear. Select per-session with /models →
ollama-local/<model>:latest, launch with
opencode --model ollama-local/muse-glimmer:latest
(<provider-slug>/<model-key>), or pin via a "model" field. Adding a
provider does NOT change the default model.
Smoke test the chat endpoint (catches wiring bugs early)
curl -s http://127.0.0.1:11434/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"<tag>","messages":[{"role":"user","content":"Say ok"}],"max_tokens":200}'
Use a GENEROUS max_tokens (200+) and timeout (180s):
- First request pays the model-load cost — an 18 GB model takes ~30s–1min+ to load; subsequent requests are fast.
- If the response has no
choices[0].message.content, check the RAW response (drop any jq filter) before concluding the endpoint is broken — see the thinking-model gotcha next.
Thinking-model gotcha: empty content ≠ failure
TRIGGER: smoke-testing a thinking/reasoning model with a small
max_tokens (e.g. 10).
ROOT CAUSE: Ollama's OpenAI-compatible endpoint maps thinking output to
a reasoning field, emitted BEFORE content. A small token budget is
entirely consumed by reasoning tokens, so content comes back empty
(finish_reason: "length") while reasoning is populated. HTTP 200 —
the endpoint works fine.
FIX: re-test with a larger max_tokens (the model is already loaded,
so the retry is fast). Do not debug the endpoint, config, or provider
wiring — that is all correct. opencode's ai-sdk handles the reasoning
field fine; expect a pause while reasoning streams before content
appears.
Stale model-pins trap
Per-agent agent.*.model fields and scheduler-job model pins do NOT
inherit the default — sweep all three surfaces (default model,
agent overrides, job pins) when changing defaults.
Follow-up additions ("add X as well")
Follow-ups ("add qwen3.8:27b-mlx as well") are the SAME procedure,
shortened: provider block already exists, so the chain is fresh
ollama list -> ollama show <tag> (context + tools gate) -> add the
model entry under the EXISTING provider models map -> python -m json.tool validation -> remind the user to restart. Execute ALL of it
in the SAME turn.
TWO disciplines (born from the 2026-08-15 qwen follow-up that drew a "Take action now" interrupt):
- NEVER reason over a PRIOR turn's
ollama listoutput — models get pulled between turns; an old listing is not ground truth. Re-run it fresh; if t
Установить opencode-ollama-provider-setup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл opencode-ollama-provider-setup?
Add an Ollama-hosted model (local laptop or a remote box like the GB10) as a usable model/provider in opencode, and verify it end-to-end. Use when the user asks to 'add <model> from ollama to opencode', 'use ollama model X in opencode', 'wire up a local model in opencode', when adding an Ollama model to opencode.json, smoke-testing an Ollama OpenAI-compatible endpoint with curl, diagnosing EMPTY content from a thinking/reasoning model, or wondering why the new provider does not appear without a restart. Covers the 5-step procedure (ollama list -> curl /v1/models -> ollama show for the tools-capability gate -> @ai-sdk/openai-compatible provider block -> JSON validation + restart), the chat-completions smoke test, the thinking-model gotcha (reasoning consumes small max_tokens -> empty content, not an endpoint failure), and the stale model-pins trap. Session history in the body.
Как установить скилл opencode-ollama-provider-setup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл opencode-ollama-provider-setup запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic