memcode docs
CLI

Authentication

Connect a backend. Use a subscription you already have, your own API key, a hosted memcode account, or a custom endpoint.

memcode stores no keys of its own. It uses a key from your environment, a login you already have with another tool, or a hosted memcode account. There are four ways to connect one.

1. Your own API key

If a provider key is set in your shell, memcode uses it. Nothing else to do.

export ANTHROPIC_API_KEY=sk-ant-...
memcode agent "summarize what this service does"

OPENAI_API_KEY works the same way. Other providers, like Gemini and Groq, work when you point MEMCODE_ENDPOINT_URL at their host. See Provider keys for the full list.

2. A subscription you already pay for

If you pay for Claude, ChatGPT, or GitHub Copilot, memcode can reuse that login instead of a key. The first-run wizard finds these for you, and you can pick one any time:

memcode auth use claude

Use codex or copilot in place of claude for those. Run memcode auth on its own for an interactive picker, or memcode auth status to see what's in use.

For the details of each, including what to sign into first, see Claude Code, Codex, and GitHub Copilot.

In a script or CI, you can set the source with an environment variable instead: MEMCODE_CREDENTIAL_SOURCE=claude.

3. A hosted memcode account

Sign in to get one balance that works across providers, a place to store your own keys, and hosted web search.

memcode login

Use memcode logout to sign this machine out.

4. A custom endpoint

Point memcode at any OpenAI-compatible server, like Ollama or vLLM.

export MEMCODE_ENDPOINT_URL=http://localhost:11434/v1
memcode

If the endpoint needs a key, set MEMCODE_ENDPOINT_KEY. To force a specific model, set MEMCODE_ENDPOINT_MODEL. For a local setup, see Ollama.

The first-run wizard

The first time you run memcode with nothing configured, it shows a short menu: the subscriptions it found, sign in to memcode, use your own key, a custom endpoint, or skip. Your choice is saved, so you set it once.

When more than one is set

A memcode login and an explicit MEMCODE_ENDPOINT_URL win over a key sitting in your environment. A subscription is only used when you have selected it.

On this page