Quickstart
Send your first routed request.
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 shows how to send your first request through that gateway. Sign up in the Console, create an API key, point your OpenAI-compatible client at LineMod, and send an
auto:* model alias.Setup
Before you call the API
You need a LineMod organization, at least one API key, and the overseas gateway base URL.
02
Create an API key
Console → API Keys. Keys start with
sr_gl_ for the overseas gateway.sr_gl_...03
Set the base URL
Keep your SDK workflow; only change the host.
https://api.linemod.ai/v104
Pick a model alias
Start with
auto:balanced or auto:cost, then tune in Console routing.auto:balancedExamples
Copy-paste samples
All examples use bearer auth and the standard chat completions body.
PythonOpenAI SDK
from openai import OpenAI
import os
client = OpenAI(
base_url="https://api.linemod.ai/v1",
api_key=os.environ["LINEMOD_API_KEY"],
)
response = client.chat.completions.create(
model="auto:balanced",
messages=[
{"role": "user", "content": "Summarize this support incident."}
],
)
print(response.choices[0].message.content)Node.jsOpenAI SDK
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.linemod.ai/v1",
apiKey: process.env.LINEMOD_API_KEY,
});
const response = await client.chat.completions.create({
model: "auto:balanced",
messages: [
{ role: "user", content: "Summarize this support incident." },
],
});
console.log(response.choices[0]?.message?.content);cURLraw HTTP
curl https://api.linemod.ai/v1/chat/completions \
-H "Authorization: Bearer $LINEMOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto:balanced",
"messages": [
{"role":"user","content":"Summarize this support incident."}
]
}'Gonet/http
body, _ := json.Marshal(map[string]any{
"model": "auto:balanced",
"messages": []any{
map[string]any{"role": "user", "content": "Hello from LineMod"},
},
})
req, _ := http.NewRequest(http.MethodPost,
"https://api.linemod.ai/v1/chat/completions",
bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")Verify
Confirm routing and tracing
Log response headers on the first successful call. They explain model choice, cost, and credential source.
ModelX-LineMod-Model-Used
ReasonX-LineMod-Route-Reason
CostX-LineMod-Cost
TraceX-LineMod-Request-Id
Console playground
Use Playground to simulate routing presets without writing code, or copy ready-made snippets from SDK snippets.
Next
What to read next
APIHeaders and streaming
RoutingAuto aliases and failover
SecurityTemplates and tool governance