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
Authorization: Bearer lattice_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtype 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
{
"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
}
}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
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
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."
cd apps/dashboard
cp .env.example .envnamestring, min 1monthlyTokenQuotainteger >= 0 | nullnull = unlimited. rateLimitPerMinuteinteger >= 0 | nullnull = unlimited. allowedModelsstring[] | nullnull = unrestricted. Checked against the raw requested model string, before alias resolution — see Model Registry & Routing. routingStrategy'cost' | 'latency' | 'balanced' | nullnull = use the registry's declared [primary, ...fallbacks] order. disabledbooleantrue 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
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.