I just followed this guy's tutorial:
https://towardsdatascience.com/run-claude-code-for-free-with-local-and-cloud-models-from-ollama/
I'm using claude code with ollama running gpt-oss:20b on my PC with my Nvidia GPU to speed it up.
I found this CLAUDE.md file works well. It tells the gpt-oss model how to use the Write tool to write to files:
My CLAUDE.md file:
## Important rules
- If the user wants you to write a file, do it. Use your Write tool to create the file. The Write tool has a required parameter called "file_path".
My interactive claude session:
▐▛███▜▌ Claude Code v2.1.29
▝▜█████▛▘ gpt-oss:20b · API Usage Billing
▘▘ ▝▝ ~/appdev/raspi
/model to try Opus 4.5
❯ create a python script called hello.py in the current directory that prints "Hello World".
● Write(hello.py)
⎿ Wrote 2 lines to hello.py
1 print("Hello World")
This is a command that runs a non-interactive claude session. You could run it via the TRIGGERcmd agent
claude -p -d --model gpt-oss:20b --permission-mode acceptEdits "create a python script called hello.py in the current directory that prints Hello World"
I created a this myclaude.bat file:
set ANTHROPIC_BASE_URL=http://127.0.0.1:11434
set ANTHROPIC_AUTH_TOKEN=ollama
cd c:\myfolder
claude -p -d --model gpt-oss:20b --permission-mode acceptEdits %1
My Command field in the GUI editor looks like this:
start /w c:\myfolder\myclaude.bat
My commands.json entry looks like this:
{
"trigger": "claude code",
"command": "start /w c:\\myfolder\\myclaude.bat",
"offCommand": "",
"ground": "foreground",
"voice": "",
"voiceReply": "",
"allowParams": "true",
"quoteParams": "true",
"mcpToolDescription": ""
}