Skip to main content

memtrunk documentation

Guides and reference for the memtrunk gateway. Connect Claude Code, Codex CLI and Antigravity CLI, manage keys, and look up endpoints, headers and errors.

Last updated

memtrunk is a gateway between your coding tools and AI providers. It also has a console where you manage keys, accounts and settings. These docs explain both parts for developers.

Where to start#

What each section covers#

  • Getting started shows how a request travels and how to connect a coding tool.
  • Concepts explains keys, account pools, provider keys, routing rules, spend limits, memory, usage and request logs.
  • Teams and administration explains roles, teams, organizations and sign-in.
  • Reference lists endpoints, authentication headers, errors, client variables and terms, and answers common questions.

How to read the examples#

Examples use two placeholders. Replace <your-memtrunk-address> with the address that the console shows. Replace <your-memtrunk-key> with a memtrunk key that you create in the console.

Never paste a real key into a shared file or a public place.

Getting started

  • How a request travels through memtrunk

    Follow one request from your coding tool through the memtrunk key check, routing rules and a provider account or key, and see what you set up as a developer.

  • Send your first request

    Sign in, create a memtrunk key, find your address and send a first POST /v1/messages request with curl. Then check GET /health and fix common errors.

  • Connect Claude Code to memtrunk

    Connect Claude Code through your personal token address, or with a named API key. Set the variables, verify the connection and fix 401, 404 and 429 errors.

  • Connect Codex CLI to memtrunk

    Connect Codex CLI through your personal token address, or with a named API key. Add the provider, select it, verify the connection and fix 404 and 429 errors.

  • Use other clients with memtrunk

    Any client that sends Anthropic Messages, OpenAI Chat Completions or OpenAI Responses requests can use the memtrunk address and a memtrunk key.

Concepts

  • Credentials, keys and accounts

    Learn the credentials in memtrunk. A memtrunk key or a proxy token goes from your client to the gateway. A provider key and account go to the provider.

  • Account pools and failover

    See how memtrunk pools Claude, ChatGPT and Codex, and Antigravity accounts. Learn how to add accounts, how share modes work, and what happens at a limit.

  • Provider keys for AI providers

    Learn how provider keys work in memtrunk. See how to add a key, the private key limit, which paths use which type, and how a custom key serves /v1/messages.

  • Routing rules and fallbacks

    Learn how to save memtrunk routing rules in the console. See the rule fields, project scope, precedence, fallbacks, where rules apply and their limits.

  • Spend limits for memtrunk keys

    Learn the spend and token limits of a memtrunk key. See how the pool cap is resolved, what counts against a limit, who sets limits, and the 429 response.

  • Memory

    Memory recalls knowledge from your earlier coding sessions. Learn the recall and capture switches, console setup, project controls, deletion and export.

  • Usage and cost estimates

    Learn how memtrunk estimates the cost of each request, who sees which usage data, how organization usage sharing works, and how to export usage history.

  • Request logs and telemetry

    Learn what the request log stores, how redaction and retention work, who sees which rows, what tool telemetry records, and how to export or delete data.

Teams and administration

  • Roles and access

    See what a member, an org admin and a read-only auditor can read and change in memtrunk, and how the server enforces each role on every request.

  • Teams and organizations

    Learn how an organization is created, what an org admin manages, how to create and edit teams in the console, and when a team monthly limit applies to keys.

  • Sign-in and accounts

    Learn how users sign in with Google or a password, the password rules, how lockout works, what a disabled account sees, and what the profile page shows.

Reference

  • Gateway endpoints reference

    Reference for the gateway request paths. It covers Anthropic Messages, count_tokens, OpenAI Chat Completions, OpenAI Responses, the model list and health.

  • Authentication headers reference

    Reference for the key headers the gateway accepts, which header wins when a request carries several, and the exact 401 replies for a missing or rejected key.

  • Errors and status codes reference

    Reference for the status codes and body shapes the gateway returns, split by request path, with exact message text for 401, 403, 404, 429 and 5xx replies.

  • Client variables reference

    Reference for the variables and config keys that the console setup guide shows for Claude Code, Codex CLI and Antigravity CLI, with placeholder values.

  • Glossary of memtrunk terms

    Short definitions of the terms in the memtrunk docs, such as memtrunk key, provider account, pool, routing rule, recall, project and spend limit, with links.

  • Frequently asked questions

    Short answers about key headers, 401 and 429 replies, provider keys, cost estimates, the read-only auditor role, organization requests and the health check.

memtrunk documentation — memtrunk