Integrations
OpenAI SDK
Drop-in — point the OpenAI SDK at the gateway by changing the base URL.
Verified. The gateway is OpenAI-compatible and continuously tested for response shape, streaming chunks, tool calling, and finish_reason.
The gateway speaks the OpenAI Chat Completions API. The only change is the base URL and your API key.
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://agent-router.gaib.ai/v1',
apiKey: process.env.GATEWAY_API_KEY, // sk-...
})
const res = await client.chat.completions.create({
model: 'gemini/gemini-2.5-flash',
messages: [{ role: 'user', content: 'Hello!' }],
max_tokens: 512,
})
console.log(res.choices[0].message.content)from openai import OpenAI
client = OpenAI(
base_url="https://agent-router.gaib.ai/v1",
api_key="sk-your-api-key",
)
res = client.chat.completions.create(
model="gemini/gemini-2.5-flash",
messages=[{"role": "user", "content": "Hello!"}],
max_tokens=512,
)
print(res.choices[0].message.content)Streaming
const stream = await client.chat.completions.create({
model: 'gemini/gemini-2.5-flash',
messages: [{ role: 'user', content: 'Tell me a story' }],
stream: true,
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '')
}Tool calling
Tool calling is supported and returns standard OpenAI shapes (finish_reason: "tool_calls" and a tool_calls array).
const res = await client.chat.completions.create({
model: 'gemini/gemini-2.5-flash',
messages: [{ role: 'user', content: 'What is the weather in Tokyo?' }],
tools: [
{
type: 'function',
function: {
name: 'get_weather',
parameters: {
type: 'object',
properties: { city: { type: 'string' } },
required: ['city'],
},
},
},
],
})thinking and reasoning_effort parameters are not supported and return HTTP 400. Strip them before calling the gateway.