Skip to content

Gateway Endpoints

Gateway routes are mounted under /api/gateway/* and enforce auth/billing checks before upstream proxying.

Base route: /api/gateway/llm

MethodPath
POST/api/gateway/llm/v1/chat/completions
POST/api/gateway/llm/v1/responses

Base route: /api/gateway/search

MethodPath
GET/api/gateway/search/v1/web/search
GET/api/gateway/search/v1/news/search

Base route: /api/webhooks/usage

MethodPathDescription
POST/api/webhooks/usageingest usage events
GET/api/webhooks/usageread usage snapshot/records
Terminal window
curl -X POST "$ROBERTO_API_URL/api/gateway/llm/v1/chat/completions" \
-H "x-api-key: $ROBERTO_AGENT_GATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "moonshotai/kimi-k2.5",
"messages": [
{"role":"user","content":"Summarize today'\''s support incidents in 3 bullets."}
]
}'

Response shape is provider pass-through (OpenAI-compatible object).

Terminal window
curl "$ROBERTO_API_URL/api/gateway/search/v1/web/search?q=robertoagent%20updates" \
-H "Authorization: Bearer $ROBERTO_AGENT_GATEWAY_TOKEN"

Response shape is upstream search-provider pass-through.

Terminal window
curl -X POST "$ROBERTO_API_URL/api/webhooks/usage?agentId=$AGENT_ID" \
-H "Content-Type: application/json" \
-H "x-idempotency-key: evt_123" \
-d '{
"messages": 2,
"inputTokens": 540,
"outputTokens": 180,
"eventId": "evt_123"
}'

Example 200 response:

{
"success": true,
"duplicate": false
}
Terminal window
curl "$ROBERTO_API_URL/api/webhooks/usage?agentId=$AGENT_ID"

Example 200 response:

{
"messages": 120,
"inputTokens": 45200,
"outputTokens": 19100,
"totalTokens": 64300,
"estimatedCost": "0.2345",
"estimatedCostUsd": 0.2345,
"eventCount": 85,
"lastUpdated": "2026-02-21T12:00:00.000Z"
}