Docs / LineMod AI Gateway

Build with one routed API.

LineMod is a security gateway with agent behavior observability—guardrails at the edge, harness diagnostics across runs, and policy routing when you need it. This page is the documentation overview for integrating through that gateway. Keep the OpenAI chat completions shape. LineMod routes, protects, and traces every request through gateway policy — with platform credits or BYOK on your own provider keys.

POST /v1/chat/completionstrace returned
{
"model": "auto:balanced",
"messages": [
  { "role": "user", "content": "Summarize this incident log." }
]
}
Requestreq_8f3k2m9x1p
Modelclaude-sonnet
Credentialplatform
Cost$0.0042
01RequestOpenAI-compatible call
02GuardrailsInput, PII, tools
03RoutingPolicy selects model
04UpstreamPlatform or BYOK key
05TraceAudit + metrics
Platform

Three domains, one gateway hot path.

Every production request flows through routing, security, and observability before and after the upstream model call.
RoutingPick the right model per request

Use auto:* presets, org rules, failover chains, and cost-quality dials. Inspect X-LineMod-Model-Used and X-LineMod-Route-Reason on every response.

SecurityGate content before upstream

Scan prompts and outputs, mask sensitive data, govern agent tool calls, and pin templates per API key. Blocked requests never reach your provider.

ObservabilityTrace every decision

Per-request IDs, cost headers, agent run waterfalls, Agent insights with harness diagnostics, and exportable audit rows in the Console.

Guides

Documentation sections

Start with quickstart, then dive into API contracts, routing aliases, and security templates.
QuickstartCreate a key and send your first request.
Console signup, base URL, auto:balanced, and copy-paste samples in Python, Node.js, Go, and cURL.
API referenceEndpoints, headers, streaming, and errors.
Chat completions, model list, request/response headers, client profile attribution, and agent run headers.
SDKKeep your OpenAI client workflow.
Point the official OpenAI SDK at https://api.linemod.ai/v1 or copy snippets from the Console.
ChangelogRecent documentation and product updates.
Safer agent tools, image checks, and new models (v1.2.0).
Billing

Platform credits or BYOK

LineMod supports two credential paths on the same API surface. The gateway tags every response with X-LineMod-Credential-Source.
ModeWho pays upstreamWhat you pay LineMod
platformLineMod wallet (platform credits)Per-token usage bundled with routing, security, and observability
org_byokYour provider contractMonthly BYOK subscription for gateway features
platform_fallbackLineMod when BYOK path is unavailable (if enabled)Fallback token usage per org policy
Hybrid orgs

Connect provider keys for OpenAI and Anthropic, route everything else through platform credits — one API key, automatic split billing. See pricing for plan details.