MemoDocumentation
EN

Developer API Gateway: Using Memo From Claude Code

Sidebar → Developer turns Memo into a local, Anthropic-compatible endpoint. Point Claude Code (or anything else that only speaks Anthropic's Messages API) at it, and Memo runs whatever's actually behind that request — your local model, or any external provider you've already configured — while Claude Code keeps working exactly the way it always does.

New in v3.9.0: the gateway also speaks the OpenAI-compatible shape — POST /v1/chat/completions and GET /v1/models through the exact same auth, routing, and memory pipeline — so tools that only understand OpenAI-style base URLs work too. A configurable system prompt (additive on top of whatever the calling tool sends) can be applied to every gateway request, and a one-click toggle writes the environment straight into Claude Code CLI's own settings file — with your prior values backed up and restored exactly on disconnect.

Step 1 — Get your Base URL

Open Memo's sidebar → Developer. The top of the screen shows a copyable Base URL — by default this is http://localhost:8090, matching the port Memo's backend listens on. If you changed the backend's port, this reflects that.

Step 2 — Point Claude Code at it

Claude Code reads its target server from environment variables. Set these before launching claude:

# bash / zsh
export ANTHROPIC_BASE_URL="http://localhost:8090"
export ANTHROPIC_API_KEY="not-needed"
export ANTHROPIC_MODEL="local/qwen2.5"
# fish
set -x ANTHROPIC_BASE_URL "http://localhost:8090"
set -x ANTHROPIC_API_KEY "not-needed"
set -x ANTHROPIC_MODEL "local/qwen2.5"

ANTHROPIC_API_KEY can be any non-empty string when the Developer screen's Require API Key toggle is off (the default) — Memo doesn't check it, but Claude Code's own SDK refuses to start without something set. If you turn Require API Key on, use the real token shown on the Developer screen instead (the same token Remote Access uses) — Claude Code sends it automatically as x-api-key.

[!IMPORTANT]
v4.5.0 security fix. An earlier release closed the key-enforcement gap for this Anthropic-compatible endpoint; this release closed the same gap for its OpenAI-compatible sibling (GET /v1/models, POST /v1/chat/completions). With "Require API Key" left off (its default) and remote access on, that endpoint could previously be reached by anything else able to reach the port, with no credential at all. Both endpoints now enforce the key identically for any caller that isn't genuinely on this machine's own loopback interface.

Step 3 — Pick a model with type/model-id

Memo's gateway reads the request's model field as <type>/<model-id>:

Value What it routes to
local/qwen2.5 Whatever local llama.cpp model is currently loaded in Memo — the qwen2.5 part is just a label, the real model is whatever's actually running
openai/gpt-4o Your enabled OpenAI provider under Settings → API Providers, with model gpt-4o
custom/<model-id> Your enabled custom provider (an OpenAI-compatible endpoint you've configured yourself — LM Studio, vLLM, etc.)

The Developer screen lists every currently valid type/model-id combination as copyable entries — it changes based on which local model you have loaded and which providers you have enabled. Set one as ANTHROPIC_MODEL before launching, or switch mid-session with Claude Code's own /model command, e.g. /model openai/gpt-4o.

Step 4 — Just use Claude Code

Run claude as you normally would. Nothing about its interface changes — reading and writing files, running shell commands, and multi-turn tool-use conversations all work exactly like they do against the real Anthropic API, because the gateway does a full, bidirectional translation of Anthropic's wire format (including the specific detail of a tool call's arguments being a JSON object on Anthropic's side vs. a JSON-encoded string on OpenAI's side).

One real limitation: tool calling doesn't yet work if the resolved model belongs to the ollama provider type — its underlying implementation in Memo doesn't support tool definitions at all yet. A tools-bearing request routed to it returns a clear error rather than silently dropping the tools, so you'll know immediately rather than getting confusing partial behavior. (gemini and claude used to be on this same short list — both gained real tool-calling in an earlier release and now round-trip it correctly.)

Checking it's actually working

The bottom of the Developer screen shows a live log of every request passing through the gateway, refreshing every couple of seconds while the screen is open — time, resolved model, whether it used streaming/tools, duration, and a preview of the request/response. This is the fastest way to confirm your first Claude Code request actually landed, and to see exactly which model it resolved to.

Memory and chat history stay separate

Two settings on this screen default to off: Require API Key (see above) and Use Memory. Turning memory integration on enriches gateway requests with relevant facts from Memo's own RAG memory before they're sent to the model — but a coding session run through Claude Code this way never creates a visible chat in Memo's own history, even with memory on. Gateway traffic and your regular chats are kept deliberately separate.