Ollama Launch Command: Connect Claude Code Locally
Learn how to use the ollama launch command to wire local models directly into Claude Code, configure endpoints, and troubleshoot common CLI errors.

The ollama launch command configures and starts external developer applications against Ollama models. Instead of hand-editing configuration files or exporting environment variables for every session, it gives you an interactive wizard and direct CLI flags to wire supported coding agents into your local inference server.
According to the Ollama CLI reference, the command directly supports five external tools: OpenCode, Claude Code, Codex, VS Code, and Droid. Here is how to prepare your local runtime, launch Claude Code with a specific model, and verify that the connection works.
Prerequisites: running the local background service#
Before launching any external integration, Ollama's local server must be running. If you try to launch an agent while the daemon is offline, requests to the local port will fail.
You start the server manually from your terminal with:
ollama serve
On Windows and macOS systems where Ollama was installed as a desktop application, this service often starts automatically in the background on system startup. On Linux systems or headless environments, keep ollama serve running in a dedicated shell or as a service.
To confirm the server responds and inspect what models are available locally, open a second terminal tab and list your downloaded models:
ollama ls
If you need to pull a new model before attaching a coding tool, use ollama pull:
ollama pull gemma4
To inspect or execute local models directly in terminal conversations, read our walkthrough on how to run an Ollama model locally.
Using ollama launch with Claude Code#
The ollama launch command accepts interactive prompts or explicit arguments for the target integration and model.
Interactive launcher#
Running the bare command opens an interactive picker in your terminal:
ollama launch
Ollama scans for installed integrations and prompts you to select one from the supported list (Claude Code, OpenCode, Codex, VS Code, or Droid). It then presents your local models so you can select the active engine for the session.
Direct launch by tool name#
To skip the menu and launch Claude Code directly, pass the integration name as an argument:
ollama launch claude
This command configures Claude Code to point to your local Ollama daemon and starts the agent session immediately.
Direct launch with a specified model#
You can override the default model selection by appending the --model flag:
ollama launch claude --model qwen3.5
If you prefer to configure an integration without starting the tool process immediately, pass the --config flag. The CLI reference demonstrates this flag syntax using the Droid agent:
ollama launch droid --config
How the connection works under the hood#
When ollama launch claude runs, it bridges Anthropic's agent harness to your local Ollama API endpoint.
As documented in the Ollama API reference, the local Anthropic client base URL is:
http://localhost:11434
The Anthropic client appends /v1/messages to this base URL when dispatching completions. Unlike cloud calls to https://ollama.com that require an OLLAMA_API_KEY, local requests sent to http://localhost:11434 require no authorization header.
Here is a small script that verifies how an Anthropic client base URL resolves against local and cloud endpoints:
def inspect_endpoint(target_host, is_cloud=False):
# Local Ollama Anthropic compatibility endpoint
clean_host = target_host.rstrip('/')
messages_path = f"{clean_host}/v1/messages"
headers = {"Content-Type": "application/json"}
if is_cloud:
headers["Authorization"] = "Bearer <api_key>"
return {
"base_url": clean_host,
"messages_endpoint": messages_path,
"requires_key": is_cloud,
"auth_header": "Authorization" in headers
}
local_spec = inspect_endpoint("http://localhost:11434", is_cloud=False)
cloud_spec = inspect_endpoint("https://ollama.com", is_cloud=True)
print(f"Local endpoint: {local_spec['messages_endpoint']} (Key required: {local_spec['requires_key']})")
print(f"Cloud endpoint: {cloud_spec['messages_endpoint']} (Key required: {cloud_spec['requires_key']})")
For details on calling other standard endpoints like /api/chat or the OpenAI compatibility route at /v1, review our reference on how to call the Ollama API.
Verifying the connection#
Once Claude Code opens via ollama launch claude, run a quick sanity check to confirm the tool receives responses from the local model rather than an external cloud provider.
- In your Claude Code session, issue a simple prompt:
Write a hello-world function in Python and exit.
- Open an alternate terminal window and run
ollama ps:
ollama ps
The output lists active models loaded in memory, their process state, and resource allocations. If your target model appears in the ollama ps output, Claude Code is actively routing its agentic turns through your local hardware.
To stop the model after your work session finishes, run ollama stop:
ollama stop qwen3.5
Troubleshooting common launch errors#
Error: command not found#
If running ollama launch returns command not found: ollama or 'ollama' is not recognized as an internal or external command:
- Check binary installation: Confirm Ollama is installed in your system path. On Linux and macOS, test running
which ollama. On Windows Command Prompt (cmd.exe) or PowerShell, test runningwhere.exe ollama. - Update to the latest release: If
ollama runworks butollama launchreports an unknown command error, your installed version of the Ollama CLI predates the release of thelaunchcommand suite.
Error: connection refused or port 11434 unreachable#
If Claude Code opens but reports timeout or connection failures:
- Check if the server is active. Run
ollama psorollama ls. - If commands fail to reach the server, execute
ollama servein a dedicated terminal window. - Check if another instance already occupies port 11434. To inspect the full list of configurable environment settings, run:
ollama serve --help
Difference between ollama launch and ollama run#
A common point of confusion is picking between launch and run:
| Command | Primary Role | Target Target | Example |
|---|---|---|---|
ollama run |
Starts an interactive chat or model execution | Local LLMs (e.g., gemma4, nimble) |
ollama run gemma4 |
ollama launch |
Configures and runs third-party agents | External applications (Claude Code, Droid) | ollama launch claude |
ollama serve |
Starts the background API daemon | Local HTTP server (localhost:11434) |
ollama serve |
When writing custom applications against Anthropic models directly in code, see our tutorials on Claude structured outputs with JSON schema and using Claude Opus 5.5 fast mode.
Quick reference checklist#
Keep this checklist handy whenever setting up local coding agents with Ollama:
- Start the server daemon if it is not already running:
bash ollama serve - Download your preferred coding model:
bash ollama pull qwen3.5 - Launch Claude Code wired directly to that model:
bash ollama launch claude --model qwen3.5 - Confirm inference runs locally in a separate terminal:
bash ollama ps - Terminate the session and release memory when finished:
bash ollama stop qwen3.5
Quick answers
What integrations work with the ollama launch command?
As documented in the official CLI guide, the command supports OpenCode, Claude Code, Codex, VS Code, and Droid.
What is the difference between ollama launch and ollama run?
The ollama run command starts an interactive prompt session directly with a local model such as gemma4, while ollama launch configures and starts external third-party tools like Claude Code or VS Code against your models.
Do I need an API key to launch Claude Code locally with Ollama?
No. Local requests to http://localhost:11434 do not require an authorization header or API key; keys are only required when calling cloud-hosted models through ollama.com.
How can I configure an integration without starting it immediately?
You can configure an integration's settings without launching the tool process by passing the --config flag, for example: ollama launch droid --config.
Did this solve it?
One tap. No account.
Sorry about that. What was missing?
from 0 readers
Saved you an hour? Send a tip.
USDC or ETH on Base, Ethereum, Arbitrum and more. Keeps the notes free and the examples running.
Network
0xc783bc5c3fa14cEC3f09A22284bC91C5AF0d59e1
On a computer? Scan the code with your phone wallet, or copy the address.
Pick the network your wallet or exchange uses. USDC works on all six; ETH on Base, Ethereum, Arbitrum and Optimism. Don't send on Tron or Solana: this address doesn't exist there. Tips are optional and unlock nothing; every guide stays free.
Discussion
Start the discussion
Next note