DOCS / MANAGEMENT API / APPLICATIONS

Applications

An application is the unit of tenancy — one row in applications, one policy, any number of API keys issued against it. See Data Model for the underlying schema.

List applications

http
Authorization: Bearer lattice_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
json
type ProviderAdapter = {
  id: ProviderId;
  createChatCompletion(
    request: ChatCompletionRequest,
    ctx: ProviderRequestContext,
  ): Promise<ChatCompletionResponse>;
  streamChatCompletion(
    request: ChatCompletionRequest,
    ctx: ProviderRequestContext,
  ): AsyncGenerator<ChatCompletionChunk, void, void>;
};

type ProviderRequestContext = {
  apiKey?: string;
  providerModel: string;
  signal: AbortSignal;
};

Create an application

http
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1755878400,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 118,
    "total_tokens": 160
  }
}
json
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1755878400,"model":"gpt-4o","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1755878400,"model":"gpt-4o","choices":[{"index":0,"delta":{"content":"Sure"},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1755878400,"model":"gpt-4o","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":42,"completion_tokens":118,"total_tokens":160}}

data: [DONE]

name must be at least 1 character. Returns the created Application (200). A new application starts with every policy field unset — unlimited quota, unlimited rate, unrestricted models, registry-declared routing order, enabled. It has no API keys yet — see API Keys to issue one.

Get an application

http
type ChatCompletionChunk = {
  id: string;
  object: 'chat.completion.chunk';
  created: number;
  model: string;
  choices: [
    {
      index: number;
      delta: { role?: 'assistant'; content?: string };
      finish_reason: 'stop' | 'length' | 'content_filter' | null;
    },
  ];
  usage?: { prompt_tokens: number; completion_tokens: number; total_tokens: number } | null;
};

Returns the Application, or 404 not_found.

Update an application

http
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.LATTICE_API_KEY,
  baseURL: 'https://gateway.internal/v1',
});

Every field is optional — send only what you're changing. All fields accept null to explicitly clear a policy back to "unrestricted."

json
cd apps/dashboard
cp .env.example .env
namestring, min 1
monthlyTokenQuotainteger >= 0 | null
null = unlimited.
rateLimitPerMinuteinteger >= 0 | null
null = unlimited.
allowedModelsstring[] | null
Each entry min length 1. null = unrestricted. Checked against the raw requested model string, before alias resolution — see Model Registry & Routing.
routingStrategy'cost' | 'latency' | 'balanced' | null
null = use the registry's declared [primary, ...fallbacks] order.
disabledboolean
true sets disabledAt to now; false clears it. Disabling an application immediately invalidates every one of its API keys, without revoking them individually — see Security.

Returns the updated Application (re-fetched after the write), or 404 not_found if the id doesn't exist, or 400 invalid_request if the body fails validation.

Per-application usage

http
NUXT_BETTER_AUTH_SECRET=<openssl rand -base64 32>
LATTICE_GATEWAY_URL=http://localhost:3001
LATTICE_MANAGEMENT_API_KEY=<the key from step 5>
DB_HOST=... DB_PORT=... DB_USER=... DB_PASSWORD=... DB_SSL=... DB_DATABASE=...

See Usage & Requests — identical shape to the gateway-wide usage endpoint, scoped to one application.

Typical provisioning flow

Create the application

POST /management/v1/applications with just a name.

Set its policy

PATCH /management/v1/applications/{id} with quota, rate limit, allowlist, and/or routing strategy — or leave it unrestricted for an internal/trusted application.

Issue an API key

POST /management/v1/applications/{id}/api-keys — see API Keys. The raw key is returned exactly once; hand it to whoever owns that application's backend.

LATTICE — INTERNAL AI INFRASTRUCTURE
GITHUB © 2026