localgate running

Your gateway is running

Your local models, as a real API.

localgate sits in front of Ollama, llama.cpp, vLLM or any OpenAI-compatible server and adds what they leave out: API keys, token accounting, memory past the context window, a dashboard, and a coding agent.

Model backendchecking…
Databasechecking…
Admin keychecking…

OpenAI-compatible

Point any OpenAI SDK, LangChain or curl at /v1. Unknown fields pass through to your backend.

API keys & usage

Per-app keys you can rate-limit and revoke, with prompt and completion tokens counted per key and model.

Memory

Send an X-Session-ID and earlier turns are stored, embedded and recalled, so a small model remembers more than its window.

Coding agent

localgate code edits your project with a local model: diffs before every write, undo, @file, !shell, Esc to stop.

Get started

  1. Have a model to serve

    localgate doesn't run models itself; it talks to your model server. With Ollama:

    ollama serve
    ollama pull llama3
    ollama pull nomic-embed-text   # optional: enables memory
  2. Sign in to the dashboard

    The first localgate serve asked you to create a login. Use that email and password at the dashboard. Skipped it, or need another account?

    localgate users create

    Scripts can use the server's admin key instead (localgate admin-key shows it); keep it to yourself and never put it in an app.

  3. Create an API key for each app or person

    In the dashboard under API keys, or from a terminal on this machine:

    localgate keys create --name my-app

    The key (lg_…) is shown once. Revoke it any time without touching the others.

  4. Call it like OpenAI

    from openai import OpenAI
    
    client = OpenAI(base_url="http://localhost:8000/v1", api_key="lg_...")
    reply = client.chat.completions.create(
        model="llama3",
        messages=[{"role": "user", "content": "Hello!"}],
    )
    print(reply.choices[0].message.content)

Coding agent

On the machine with your models, no key or login needed:

cd your-project
localgate code
  • /init writes LOCALGATE.md project instructions
  • @file attaches a file, !cmd runs a shell command
  • Esc interrupts; /undo reverts the last write

Use it from another machine

On a laptop with no models of its own, install localgate and run the agent — it asks where models should run:

pip install localgate
localgate code

Owner: Dashboard → Share creates a key for each device — which models, which networks, how many tokens — with a QR code that sets it up. Turn on Internet access there for devices on other networks.