Quickstart
Send your first request through LineMod
Create a LineMod API key, set the gateway base URL in your OpenAI client, and send a request with an
auto:* model alias.Setup
Before you call the API
Before you start, create a LineMod organization and API key. Use the gateway base URL shown below.
02
Create an API key
Console → API Keys. Keys start with
sr_gl_ for the overseas gateway.sr_gl_...03
Set the base URL
Set your OpenAI client's base URL to https://api.linemod.ai/v1.
https://api.linemod.ai/v104
Pick a model alias
Use
auto:balanced for your first request. You can choose another alias or adjust routing rules in Console later.auto:balancedExamples
Request examples
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
After a successful request, log the response headers for the selected model, routing reason, estimated cost, and request ID.
ModelX-LineMod-Model-Used
ReasonX-LineMod-Route-Reason
CostX-LineMod-Cost
TraceX-LineMod-Request-Id
Console playground
Preview routing presets in Console Playground, or copy examples from SDK Snippets.
Next
What to read next
APIHeaders and streaming
RoutingAuto aliases and failover
SecuritySecurity templates and tool access