Claude Code
Run Claude Code on Memtro as its model, add Memtro's tools to it, or run Memtro on your Claude Code subscription.
Memtro and Claude Code fit together three ways, and they combine: Claude Code can run on Memtro as its model, it can use Memtro's tools, and Memtro can run on your Claude Code subscription.
Memtro as Claude Code's model
Claude Code speaks the Anthropic Messages API, which Memtro serves at POST /v1/messages. Point it at Memtro and every session gets your organisation's memory, your connectors, routing on your own ladder, your cost allowances and the request log — with no change to how you use Claude Code.
- Create a personal API key on Dashboard → Profile → API keys.
- Put this in
~/.claude/settings.json(or.claude/settings.jsonin one project):
{
"env": {
"ANTHROPIC_BASE_URL": "https://platform.memtro.com",
"ANTHROPIC_AUTH_TOKEN": "sk-memtro-...",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "auto",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "auto",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "auto",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "900000"
}
}
- Start Claude Code as usual.
/modellists what your Memtro keys can reach, and every reply carries the routing decision.
Four things worth knowing:
- The base URL has no
/v1on it. Claude Code appends the path itself, sohttps://platform.memtro.comis right andhttps://platform.memtro.com/v1gives you/v1/v1/messages. - Leave
ANTHROPIC_API_KEYunset. Two credentials at once is ambiguous; useANTHROPIC_AUTH_TOKEN. If you would rather send Memtro's key the way the Anthropic SDKs do,x-api-keyworks too. - All three tiers set to
autois the configuration to want: whichever tier Claude Code picks, Memtro chooses the model by how hard the request is, on your ladder. Name a model instead (anthropic/claude-opus-5,openai/gpt-5.4,google/gemini-3.1-pro-preview) if you would rather be explicit — including models from a provider Claude Code could not otherwise reach. - Keep
claude-code/*out of the ladder those sessions route on. Otherwise Claude Code asks Memtro, which runs Claude Code headless to answer: twice the wait and twice the spend. Useauto/anthropic, or a ladder of API models.
Memtro's memory is injected and the exchange is learned from, exactly as it is for any other client — so what you work out in a Claude Code session is available to the next question somebody asks in Chat.
What the model sees
Memtro's own tools run on the server and their results come back inside the answer; your own Claude Code tools — Read, Edit, Bash — stay yours and come back as tool_use blocks for Claude Code to run, which is what Claude Code expects. Add Memtro's tools to that set with the MCP registration below and you have both: its file and shell tools on your machine, Memtro's memory and connectors on the server.
Memtro's tools inside Claude Code (MCP)
The quick way: the Memtro plugin
In a Claude Code session:
/plugin marketplace add memtro-org/claude-memtro
/plugin install memtro@memtro
Claude Code asks for your API key when the plugin is enabled, and that is the whole setup. Use a personal key from Dashboard → Profile → API keys: it acts as you, with your memory, connections and permissions. The plugin marks it sensitive, so Claude Code keeps it in your system's secure credential store rather than in settings.json. Change it later with /plugin configure memtro@memtro.
Installing from a shell never prompts, so pass the key there:
claude plugin marketplace add memtro-org/claude-memtro
claude plugin install memtro@memtro --config api_key=sk-memtro-...
The plugin brings two things:
- Memtro's MCP server, so
memtro_search,memtro_remember,memtro_why,memtro_measuresand the rest arrive in every session, with one tool per connected system you have access to. They are namedmcp__plugin_memtro_memtro__*;/mcplists them. - A
memtroskill that tells Claude when to use them: search memory before guessing about the company, read a figure's agreed definition before quoting it, and save decisions withmemtro_rememberas self-contained statements, shared or personal. Claude loads it when a task calls for it, or run/memtro:memtroyourself.
For a self-hosted Memtro, set Memtro address (base_url) to your installation. The plugin is open source at memtro-org/claude-memtro, MIT licensed.
By hand
Register the server yourself when you want to narrow what it serves, or are not using plugins.
- Create a personal API key on Dashboard → Profile → API keys — it acts as you, with your memory, connections and permissions.
- Register Memtro as an HTTP MCP server:
claude mcp add --transport http memtro https://platform.memtro.com/api/mcp \
--header "Authorization: Bearer sk-memtro-..."
Add --scope user to make it available in every project. Check it with claude mcp list.
An organisation with many connections serves many tools. A query string on the address narrows them: ?tools=memory for the memtro_* tools alone, ?actions=none to drop every tool that changes anything, ?connectors=xero,github for named systems.
- In a session, ask Claude Code to use it: "Search memtro for what we decided about the Q3 launch", "Through memtro, get Help Scout ticket 2450 and check the customer's orders in the warehouse." The tools are named
mcp__memtro__memtro_search,mcp__memtro__hubspot_search, and so on.
Everything Claude Code looks up this way is anchored into Memtro's memory, and memtro_remember lets it save decisions for the rest of the team.
Running Memtro on your Claude Code subscription
Memtro can run requests through the Claude Code CLI itself, headless, authenticated with your own Claude Code token, the same way a CI job would.
- On a machine where you are signed in to Claude Code, run:
claude setup-token
- Copy the printed token (it starts with
sk-ant-oat01-). - On Dashboard → Providers open Claude Code and paste it. An Anthropic API key works there too and is billed to the API instead.
- Use these model ids:
| Model id | Runs |
|---|---|
claude-code/opus, claude-code/sonnet, claude-code/haiku, claude-code/fable | the current model of that tier, resolved by the CLI |
claude-code/claude-opus-5 (any full id) | that exact model |
auto/claude-code | complexity routing across the Claude Code ladder |
Each request is one headless claude -p run in a sandboxed container: every built-in tool is disabled, Memtro's tools are attached over MCP, text and tool activity stream back as normal. Chat mode allows eight tool turns; agent mode uses your step budget with high effort.
Anthropic's consumer terms restrict using subscription tokens outside Claude Code itself. This feature runs your own subscription through your own Memtro the way the CLI would. It is your call to make, and the Providers page says the same.
Claude Code as the agent engine for API-key models
If you use an Anthropic API key rather than a token, you can still run requests through Claude Code's harness: add the key under the Claude Code provider rather than under Anthropic (it accepts an Anthropic API key, billed to the API) and use claude-code/* or auto/claude-code models. The harness is chosen by the credential and the model, not by a setting: there is no engine option on the Routing page, and an engine field on a request is not read. Client-declared tools work here too: they are bridged into the Claude Code run and come back as tool calls.
Troubleshooting
- invalid x-api-key: you pasted a Claude Code token under Anthropic. Tokens belong under the Claude Code provider; Anthropic takes Console keys (
sk-ant-api03-…). - Claude Code is not available on this server: the engine is temporarily unavailable; retry or use an
anthropic/*model with an API key.