Run Claude Code on local models via Ollama

Posted on Oct 21. Task: The author configured Claude Code to use a local Ollama model (qwen3.5:9b) by setting environment variables for the API base URL and token. They ran the agent inside IntelliJ IDEA's terminal to build a Java console task manager. The workflow involved prompting the agent to plan, create files, and fix errors, with the human approving each change before execution.; tools: Claude Code. Human role: The original post does not say how a person stayed involved.; limitations: Prerequisites include installing Claude Code via npm, Ollama, and a compatible coding model. The local model's effectiveness depends on the user's hardware capabilities. The author notes that system prompts consume context window space, which can hinder smaller models. A hybrid local/cloud workflow is suggested but untested..

Tools

Claude Code

Published on Agent Work Atlas:

Overview

Posted on Oct 21

Workflow

The author configured Claude Code to use a local Ollama model (qwen3.5:9b) by setting environment variables for the API base URL and token. They ran the agent inside IntelliJ IDEA's terminal to build a Java console task manager. The workflow involved prompting the agent to plan, create files, and fix errors, with the human approving each change before execution.

Reported result

The local setup successfully generated and ran the Java application, with the agent fixing its own errors. However, the author explicitly states they have not tested a hybrid workflow (local for reading, cloud for review) and notes that local model quality is 'Good for small tasks' but lower than cloud models. No specific performance metrics or failure rates were provided.

Human role

The original post does not say how a person stayed involved.

Limitations

Prerequisites include installing Claude Code via npm, Ollama, and a compatible coding model. The local model's effectiveness depends on the user's hardware capabilities. The author notes that system prompts consume context window space, which can hinder smaller models. A hybrid local/cloud workflow is suggested but untested.

Try it

I want to set up Claude Code with a local Ollama model to build a small [replaceable: language/framework] project, such as a [replaceable: specific app type, e.g., CLI tool]. First, ensure Ollama is running and you have pulled a model like [replaceable: model name, e.g., qwen3.5:9b]. Configure Claude Code by setting ANTHROPIC_BASE_URL to http://localhost:11434 and ANTHROPIC_AUTH_TOKEN to 'ollama'. Start Claude Code in the project directory. Prompt it to create the initial structure and core logic. Crucially, review and approve each file creation and command execution step-by-step. Do not allow autonomous execution without my confirmation. After the initial build, run the application to verify functionality. If errors occur, ask the agent to fix them, but again, approve each change. Finally, provide a summary of the files created and any manual adjustments needed. If the local model struggles with complex logic, note the specific failure points for potential cloud-assisted review.

Original source

Source reports are not independently verified. Publication date is the catalog publication date, not the original article date.

More cases · Software & development