How to call multiple AI agents through one API
Stop managing a separate SDK, key, and billing setup per agent. Here's how to discover and invoke many AI agents through a single unified API with one key.
Diterbitkan
The moment you use more than one hosted agent, integration tax kicks in: a different base URL, a different auth scheme, a different request shape, and a separate invoice for each. A unified agent gateway collapses all of that into one endpoint, one key, and one bill — the same move OpenRouter made for language models, applied to agents.
The pattern
A gateway sits in front of many agents and gives you three things:
- One directory to discover agents (by capability, scenario, or popularity).
- One credential — a single API key that works across every agent.
- One protocol surface — call any agent the same way, with metering and billing handled centrally.
Step 1 — discover agents
Ask the registry for the catalog. It returns Markdown by default (ideal to drop straight into an LLM's context) or JSON:
curl "https://takoapi.com/api/registry?format=json&q=research"
Step 2 — get a key
Create an API key in the dashboard. The same key authorizes every agent; usage is metered per call so you get one consolidated bill instead of N.
Step 3 — invoke any agent
Call a hosted agent through the gateway. Three surfaces are available depending on your client:
# A2A passthrough
curl -X POST https://takoapi.com/v1/agents/<slug>/message \
-H "Authorization: Bearer $TAKO_KEY" \
-H "Content-Type: application/json" \
-d '{"message":{"role":"user","parts":[{"text":"Summarize this URL ..."}]}}'
# Streaming (Server-Sent Events)
curl https://takoapi.com/v1/agents/<slug>/stream -H "Authorization: Bearer $TAKO_KEY" ...
# OpenAI-compatible shim — point any OpenAI SDK at this base URL
curl https://takoapi.com/v1/chat/completions -H "Authorization: Bearer $TAKO_KEY" ...
The OpenAI-compatible surface is the fastest path if you already have code using an OpenAI SDK: change the base URL and key, and you're calling agents instead of raw models — no new SDK to learn.
Step 4 (optional) — let your coding agent do it
If you live in Claude Code, Codex, or OpenCode, install TakoAPI as a skill or MCP server and your agent gains search_agents / invoke_agent natively:
curl -fsSL https://takoapi.com/install.sh | sh
# or, as an MCP server:
claude mcp add --transport http takoapi https://takoapi.com/mcp
Why route through a gateway at all
- Less code — one integration instead of one per agent.
- One bill — metered centrally; top up once.
- Swap freely — try a different agent for the same job by changing a slug, not rewriting an integration.
Related: What is A2A? · TakoAPI vs OpenRouter