Docs / Integrations
Model provider gateway
Send model calls through RaiCentral by changing the SDK base URL.
The gateway exposes provider-compatible routes. Your application authenticates with its runtime credential; RaiCentral applies policy, attaches the provider credential held on the server, meters usage and issues a receipt in the x-rai-receipt-id header.
| Provider | Route prefix |
|---|---|
| OpenAI | /providers/openai/v1 |
| Anthropic | /providers/anthropic/v1 |
| Azure OpenAI | /providers/azure-openai |
| Gemini Developer API | /providers/google-ai |
| Vertex AI | /providers/vertex-ai |
| Google, auto-detected | /providers/genai |
| Bedrock | /providers/bedrock |
| Ollama (off by default) | /providers/ollama/v1 |
Before the first call
- Set the provider's server credentials.
- Register the model in the catalog with the matching provider and model name.
- Declare the model on the agent version behind your runtime identity.
An unregistered model is denied with RESOURCE_NOT_REGISTERED.
OpenAI
import os
from openai import OpenAI
client = OpenAI(
base_url=os.environ["RAI_BASE_URL"] + "/providers/openai/v1",
api_key=os.environ["RAI_AGENT_KEY"], # runtime credential, not an OpenAI key
)
reply = client.chat.completions.create(
model="gpt-4.1",
messages=[{"role": "user", "content": "Summarize this ticket."}],
)Anthropic
import os
from anthropic import Anthropic
client = Anthropic(
base_url=os.environ["RAI_BASE_URL"] + "/providers/anthropic",
api_key="unused",
default_headers={"X-RAI-Agent-Key": os.environ["RAI_AGENT_KEY"]},
)Google Gen AI
import { GoogleGenAI, setDefaultBaseUrls } from "@google/genai";
const gateway = process.env.RAI_BASE_URL + "/providers/genai";
setDefaultBaseUrls({ vertexUrl: gateway, geminiUrl: gateway });
const ai = new GoogleGenAI({ apiKey: process.env.RAI_AGENT_KEY });A complete Vertex AI example is in examples/gemini_gateway_ts.
Blocked requests
{
"error": { "type": "rai_gateway_error", "code": "POLICY_DENIED", "message": "…" },
"rai": {
"gateway_generated": true,
"decision": "DENY",
"reason_codes": ["RESOURCE_NOT_REGISTERED"],
"receipt_id": null,
"approval_request_id": null,
"mode": "ENFORCE"
}
}When approval is required, resend an identical request body after approval. Defaults include a 10 MiB body limit and 120 requests per minute per runtime.
Calls that go directly to a provider are not governed. Use network controls and server-side credentials so applications cannot bypass the gateway.