aiml docs
SDKs

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.ml over Streamable HTTP, authenticated by your aiml API key as a bearer token.
  • aiml mcp over 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

ToolScopeWhat it answers
list_models, get_modelinferencewhat this key may use, and what each model can do
list_endpoints, get_pricesinferencewhich endpoint would serve it, in which region, at what price
estimate_costinferencewhat a request of this size costs on each endpoint
dry_runinferencethe plan the gateway would take and the reserve it would hold — no provider is called
get_balanceread:creditsavailable and held credit
get_usageread:usagespend over a window, optionally grouped
get_request, search_requestsread:usagewhat one request cost and why; find the ones that failed
list_policies, simulate_policymanage:policiesyour routing policies, and what one would do to a request
create_keymanage:keysmint a key; the secret is shown once
search_docsinferencesearch 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 full
  • aiml://policies/{name} — a routing policy's versions
  • aiml://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.

On this page