New Tool Radar

Local AI

How to Call LocalAI With the Anthropic Messages API

Point an Anthropic-compatible client at LocalAI's server, which speaks the Anthropic Messages format as well as OpenAI's.

Schematic diagram with four steps: start LocalAI, point the Anthropic client at localhost:8080, send a Messages request, then read the local model's reply.

LocalAI’s API speaks more than one dialect: it is OpenAI-compatible, and it also speaks the Anthropic Messages format. That means a client written for Claude’s API can run against your local model with a base-URL change, the same way Claude Code points at LM Studio.

Point the Anthropic client at LocalAI

Start LocalAI and set the Anthropic-compatible client’s base URL to the LocalAI server, http://localhost:8080, with the Messages endpoint path. The client sends its Messages API requests to LocalAI, and the local model answers in the Anthropic format — no model-side change needed, because LocalAI translates the format for you.

Base URL: http://localhost:8080
Endpoint: Anthropic Messages API format
# the client sends Messages requests; LocalAI answers them locally

A local model is not Claude: expect weaker tool use and reasoning than the hosted model, and some client features may behave differently. The point of the endpoint is compatibility — your client code does not change, only the server it talks to.

Try it: four checks

Check What you should see If you do not see it
Server running LocalAI is up on port 8080 Start it first
Base URL set The client points at localhost:8080 Check the URL spelling
Client connects The client starts without a connection error Check the endpoint path
Local model answers Replies come from your local model Ask something only it would say

Expected result. We checked the LocalAI README, which says the API speaks OpenAI and Anthropic formats. We did not call the endpoint on this machine.

Limits

This guide covers the Anthropic format only. A local model will not match hosted Claude’s tool use or reasoning. We did not test any call ourselves.

Sources

See all