MCP server
Give an agent the catalog, the prices, your usage and a dry run — over the Model Context Protocol.
aiml speaks MCP, so an agent can ask which models it may use, what a request would cost, where it would be routed and what one already cost — without you writing any of that plumbing.
Two transports, the same tools:
mcp.ai.mlover Streamable HTTP, authenticated by your aiml API key as a bearer token.aiml mcpover stdio, which an editor or agent launches as a subprocess.
Connecting
{
"mcpServers": {
"aiml": {
"type": "http",
"url": "https://mcp.ai.ml",
"headers": { "Authorization": "Bearer aiml-live-…" }
}
}
}Or locally, with the binary:
{
"mcpServers": {
"aiml": {
"command": "aiml",
"args": ["mcp"],
"env": { "AIML_API_KEY": "aiml-live-…" }
}
}
}The hosted server holds no key of its own. Every call it makes carries your bearer token, so a tool can never reach further than that key could, and an unauthenticated request is refused before the protocol starts.
Tools
| Tool | Scope | What it answers |
|---|---|---|
list_models, get_model | inference | what this key may use, and what each model can do |
list_endpoints, get_prices | inference | which endpoint would serve it, in which region, at what price |
estimate_cost | inference | what a request of this size costs on each endpoint |
dry_run | inference | the plan the gateway would take and the reserve it would hold — no provider is called |
get_balance | read:credits | available and held credit |
get_usage | read:usage | spend over a window, optionally grouped |
get_request, search_requests | read:usage | what one request cost and why; find the ones that failed |
list_policies, simulate_policy | manage:policies | your routing policies, and what one would do to a request |
create_key | manage:keys | mint a key; the secret is shown once |
search_docs | inference | search this documentation |
Each tool names the scope it needs, so a model can explain a refusal
instead of retrying it. The scope is enforced by the API, not by this
server: the refusal you see is the same one curl would get, and it lands
in your org's audit log the same way.
Only create_key writes anything. Everything else is marked read-only, so
a client that asks before running destructive tools has exactly one to ask
about.
Resources
aiml://models/{vendor}/{model}— one model in fullaiml://policies/{name}— a routing policy's versionsaiml://docs/{path}— a documentation page as Markdown
Prompts
- pick a model for this task — walks the catalog, the endpoints, the cost estimate and a dry run, in that order, and says what is being traded away.
- explain this request's cost — takes a request id and reconstructs the arithmetic line by line.
What it will not do
It cannot send a generation. dry_run tells an agent what a request would
cost and where it would go; actually spending money is a decision for the
code you wrote, through the SDK or the API, not for a tool call an agent
makes while it is thinking.