For AI Agents
How an autonomous agent consumes the gateway as a tool — OpenAI-compatible API, machine-readable spec, and a drop-in base URL.
This gateway is built to be driven by code and by AI agents, not just read by humans. If you are an agent (or building one), everything you need is machine-readable.
Start here
- API contract:
/openapi.yaml— complete OpenAPI 3.1 spec (endpoints, schemas, auth). Feed it to a tool/function generator. - Docs as context:
/llms.txt(index) and/llms-full.txt(every page as one markdown file). Drop either into a system prompt. - Base URL:
https://agent-router.gaib.ai
The one thing to know
The gateway is OpenAI-compatible. Any agent or framework that already speaks the OpenAI API works by changing one base URL — no new SDK, no custom client.
from openai import OpenAI
client = OpenAI(
base_url="https://agent-router.gaib.ai/v1",
api_key="sk-your-key", # see "Getting a key" below
)
resp = client.chat.completions.create(
model="gemini/gemini-2.5-flash", # switch providers by changing this string
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://agent-router.gaib.ai/v1',
apiKey: 'sk-your-key',
});
const resp = await client.chat.completions.create({
model: 'kimi/kimi-k2.5',
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(resp.choices[0].message.content);curl https://agent-router.gaib.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini/gemini-2.5-flash",
"messages": [{"role": "user", "content": "Hello"}]
}'Choosing a model
Models are addressed as provider/model. Switch providers by changing the string — nothing else changes. The live list with pricing is at GET /v1/models (no auth required), so an agent can discover models at runtime.
curl https://agent-router.gaib.ai/v1/modelsTool / function calling
Standard OpenAI tools and tool_choice are accepted and forwarded to the provider, so agentic tool-use loops work unchanged. Streaming is supported with "stream": true (SSE, terminated by data: [DONE]).
Not supported
Requests containing thinking or reasoning_effort are rejected with HTTP 400. Pick a model rather than a reasoning flag.
Getting a key (no human in the loop after setup)
Authentication is your wallet, not an account. A key is minted by signing a SIWE message — see API Keys. Once an agent holds an sk-… key, every other call is a plain Authorization: Bearer request. Balance is funded via x402 top-up; an agent can check its own credit any time:
curl https://agent-router.gaib.ai/v1/balance/0xYourWallet # public, no authBilling an agent can reason about
- Balance is reserved before each call (based on
max_tokens) and reconciled to actual usage — concurrent calls can never overspend. - A
402with{"error":"INSUFFICIENT_BALANCE"}means top up; a429means slow down. All error codes are enumerated in Errors and the OpenAPI spec. - Per-key spend and token counts:
GET /v1/usage/:wallet.