在本地模型上通过Ollama运行Claude代码

Run Claude Code on local models via Ollama

设置Claude代码在IntelliJ中的指南以及通过Ollama将其连接到本地模型进行编码工作。

软件与开发运维 Claude Code Claude Codex Grok Bot hermes-agent DEV · 2026-10-21

做了什么

The author installed Claude Code with npm and ran it from IntelliJ's built-in terminal. They pulled the qwen3.5:9b model in Ollama and pointed Claude Code at Ollama's Anthropic-compatible local endpoint with environment variables. An ollama launch command is offered as a shortcut. As a test, they asked it to build a Java console task manager. The person approved each change.

效果如何

Per the author, the agent planned the work, created the files, ran the program and fixed its own errors, and the app worked. The author rates local quality as good only for small tasks, and speed depends on your hardware.

值得注意

Speed depends on your hardware, and the author says the setup only works if your machine can handle the model. Start with a small project.

试试这个 Prompt

Help me set up Claude Code to run against a local model through Ollama on my [Mac/Windows/Linux] machine, using [IntelliJ/my editor] as my IDE. Walk me through installing Ollama, pulling a suitable coding model for my hardware ([RAM/GPU]), and pointing Claude Code at it. You're done when Claude Code answers a simple request about a file in [my project folder] using the local model. Show me any config files or commands before you change or run them.

阅读原文 ↗

相关用例