OpenRouter
Govern agents that route models through OpenRouter with AxioRank. OpenRouter speaks the OpenAI API, so the AxioRank OpenAI adapter guards every tool call with no OpenRouter-specific package.
OpenRouter is an OpenAI-API-compatible endpoint that routes a single request to whichever model you pick (Anthropic, Google, Meta, and many more). Because the wire format is the OpenAI API, you point the OpenAI Agents SDK at OpenRouter's base URL and the AxioRank OpenAI adapter guards the agent's tools directly. There is no OpenRouter-specific package to install.
Install
npm install @axiorank/sdk @openai/agentspip install "axiorank[openai-agents]" openai-agentsPoint the client at OpenRouter, then guard each tool
The only OpenRouter-specific step is the base URL and key on the model client. Tool guarding is the standard OpenAI adapter.
import { AxioRank } from "@axiorank/sdk";
import { guardExecute } from "@axiorank/sdk/openai-agents";
import { Agent, tool, setDefaultOpenAIClient } from "@openai/agents";
import OpenAI from "openai";
// OpenRouter is OpenAI-compatible: just swap the base URL + key.
setDefaultOpenAIClient(
new OpenAI({
baseURL: "https://openrouter.ai/api/v1",
apiKey: process.env.OPENROUTER_API_KEY,
}),
);
const axio = new AxioRank({ apiKey: process.env.AXIORANK_KEY }); // axr_live_...
const refund = tool({
name: "refund",
parameters,
execute: guardExecute("refund", doRefund, axio),
});
const agent = new Agent({ model: "anthropic/claude-opus-4", tools: [refund] });from agents import Agent, function_tool, set_default_openai_client
from openai import AsyncOpenAI
from axiorank import AxioRank
from axiorank.integrations.openai_agents import guard_tool
set_default_openai_client(
AsyncOpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"],
)
)
axio = AxioRank(api_key="axr_live_...")
agent = Agent(model="anthropic/claude-opus-4", tools=[guard_tool(refund, axio)])Every tool call the agent proposes is scored for leaked secrets, PII,
destructive operations, prompt injection, and egress, checked against your
policy, and written to the audit log before it runs, no matter which underlying
model OpenRouter routed to. On a deny, the model gets a short, readable
refusal it can recover from.
Report the model for spend governance
Pass the OpenRouter model id (e.g. anthropic/claude-opus-4) and token counts
on your governed calls and AxioRank attributes cost per agent and per model on
the Spend dashboard, even across OpenRouter's mixed fleet.
Next steps
- OpenAI Agents SDK adapter: the adapter this reuses.
- Content-inspection engine: what each call is scored against.
- Gateway API: the HTTP contract behind every adapter.
Cloudflare Agents
Govern a Cloudflare Agent's tools with AxioRank. The Agents SDK uses Vercel AI SDK tools, so the AxioRank Vercel adapter guards them with no rewrite.
Strands Agents
Govern a Strands (AWS) agent's tools with AxioRank. Wrap each @tool so every call is scored before it runs, with no rewrite.