You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/integrations.md
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,6 +166,67 @@ This section provides step-by-step instructions for configuring specific softwar
166
166
After saving the configuration file, restart OpenCode for the changes to take effect.
167
167
168
168
169
+
### Claude Code
170
+
171
+
[Claude Code](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's official CLI tool for coding with Claude. LocalAI implements the Anthropic Messages API (`/v1/messages`), so Claude Code can be pointed directly at a LocalAI instance.
172
+
173
+
#### Prerequisites
174
+
175
+
- LocalAI must be running and accessible (either locally or on a network)
176
+
- You need to know your LocalAI server's IP address/hostname and port (default is `8080`)
177
+
- An API key configured in your LocalAI instance
178
+
179
+
#### Running Claude Code with LocalAI
180
+
181
+
Set the `ANTHROPIC_BASE_URL` and `ANTHROPIC_API_KEY` environment variables to point Claude Code at your LocalAI server:
182
+
183
+
```bash
184
+
ANTHROPIC_BASE_URL=http://127.0.0.1:8080 \
185
+
ANTHROPIC_API_KEY=your-localai-api-key \
186
+
claude --model your-model-name
187
+
```
188
+
189
+
For example, if you have a Gemma model loaded:
190
+
191
+
```bash
192
+
ANTHROPIC_BASE_URL=http://127.0.0.1:8080 \
193
+
ANTHROPIC_API_KEY=your-localai-api-key \
194
+
claude --model gemma-4-12B-it-GGUF
195
+
```
196
+
197
+
You can also run a single prompt non-interactively:
198
+
199
+
```bash
200
+
ANTHROPIC_BASE_URL=http://127.0.0.1:8080 \
201
+
ANTHROPIC_API_KEY=your-localai-api-key \
202
+
claude -p "list the files in /tmp" --model your-model-name
203
+
```
204
+
205
+
#### Configuration
206
+
207
+
To avoid setting environment variables every time, you can add them to your shell profile (e.g., `~/.bashrc` or `~/.zshrc`):
208
+
209
+
```bash
210
+
export ANTHROPIC_BASE_URL=http://127.0.0.1:8080
211
+
export ANTHROPIC_API_KEY=your-localai-api-key
212
+
```
213
+
214
+
#### Verify available models
215
+
216
+
Check which models are available in your LocalAI instance:
217
+
218
+
```bash
219
+
curl http://127.0.0.1:8080/v1/models
220
+
```
221
+
222
+
Use one of the listed model IDs as the `--model` argument.
223
+
224
+
#### Notes
225
+
226
+
- Models with tool calling support (e.g., Gemma 4, Qwen 3) work best, as Claude Code relies heavily on tool use for file operations and code editing.
227
+
- Larger models generally produce better results for complex coding tasks.
228
+
- The Anthropic Messages API endpoint supports both streaming and non-streaming modes.
229
+
169
230
### Charm Crush
170
231
171
232
You can ask [Charm Crush](https://charm.land/crush) to generate your config by giving it this documentation's URL and your LocalAI instance URL. The configuration will look something like the following and goes in `~/.config/crush/crush.json`:
0 commit comments