Developer channel
Start routing in minutes.
Point your server-side client at The Flow Layer, keep your message shape, and let policy handle fallback, spend, provider health, and trace metadata behind the call.
Send your first routed request.
Create a server-side key, choose a Flow route, and send a normal chat request. The response returns model output plus the routing metadata your product needs to debug cost, latency, fallback, and provider movement.
Call the chat route directly.
The direct HTTP path is the fastest way to prove traffic, fallback, and tracing. Keep app and environment headers stable so the control plane can group traffic by product surface later.
curl https://api.theflowlayer.ai/v1/chat/completions \
-H "Authorization: Bearer $FLOW_LAYER_API_KEY" \
-H "Content-Type: application/json" \
-H "X-FlowLayer-App: studio-console" \
-H "X-FlowLayer-Env: production" \
-d '{
"model": "flow/best-reasoning",
"messages": [
{ "role": "user", "content": "Compare these model routes for a code review agent." }
],
"route": {
"fallback": true,
"latency_budget_ms": 1800
}
}'
Use fetch from your server runtime.
Node, edge functions, and internal tools can call the same endpoint. Toggle streaming when your UI needs incremental output and keep route controls in the body.
const response = await fetch("https://api.theflowlayer.ai/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.FLOW_LAYER_API_KEY}`,
"Content-Type": "application/json",
"X-FlowLayer-App": "studio-console",
"X-FlowLayer-Env": "production",
},
body: JSON.stringify({
"model": "flow/best-reasoning",
"stream": true,
"messages": [
{ role: "system", content: "Answer in the product team's incident format." },
{ role: "user", content: "Turn this incident into a remediation plan." },
],
"route": {
"fallback": true,
"latency_budget_ms": 1800,
},
}),
});
console.log(await response.text());
Use Python for jobs and evaluation runs.
Batch jobs, eval runners, and workflow workers can share the same route contract. Store the key in your runtime secret manager and pass workload identity on every call.
import os
import requests
response = requests.post(
"https://api.theflowlayer.ai/v1/chat/completions",
headers={
"Authorization": f"Bearer {os.environ['FLOW_LAYER_API_KEY']}",
"Content-Type": "application/json",
"X-FlowLayer-App": "eval-runner",
"X-FlowLayer-Env": "staging",
},
json={
"model": "flow/fast-eval",
"messages": [
{"role": "user", "content": "Score this support answer for policy fit."}
],
"route": {
"fallback": True,
"latency_budget_ms": 2400,
},
},
timeout=30,
)
print(response.json())
Keep the client shape you already ship.
If your app already has a chat client, point its base URL at The Flow Layer and swap the key and model route. Messages, tools, JSON response handling, and streaming stay familiar while routing policy moves into the layer.
Route agent loops through the same lane.
Tool-using agents should keep orchestration in the framework and send only the model step through Flow policy. That keeps approvals, fallback, and telemetry consistent across interactive and background agents.
async function runAgentStep(messages, tools) {
return fetch("https://api.theflowlayer.ai/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.FLOW_LAYER_API_KEY}`,
"Content-Type": "application/json",
"X-FlowLayer-App": "developer-agent",
"X-FlowLayer-Env": "production",
},
body: JSON.stringify({
model: "flow/agent-reasoning",
messages,
tools,
route: {
fallback: true,
require_tool_approval: true,
},
}),
});
}
Bring frameworks without moving the product logic.
LangChain, Vercel AI SDK, custom agent loops, and internal job runners can all share the same base URL and model route naming. The Flow Layer sits under the framework, not around your application.
Set the production envelope before launch.
Treat route policy like release configuration. Scope keys by environment, keep fallback inside approved alternates, and review trace data before promoting a workload to production traffic.
Fold the channel back into the homepage.
This docs page stays deep and practical. The homepage stays the enterprise control-plane story, with clear handoffs into implementation when a team is ready.