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 run "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, GitHub Copilot, or Grok (SuperGrok or X Premium+), memcode can run on that subscription instead of a key. The first-run wizard offers these, and you can pick one any time:
memcode auth use claude # Claude Pro/Max
memcode auth use codex # ChatGPT
memcode auth use copilot # GitHub Copilot
memcode auth use grok # SuperGrok / X Premium+Claude, ChatGPT, and Copilot reuse a login already on your machine; Grok signs
you in with a quick browser approval. 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, GitHub Copilot, and Grok.
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 loginUse 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
memcodeIf 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.