Use TeamoRouter with Coinbase AgentKit
Coinbase AgentKit gives an AI agent onchain tools: wallets, transfers, swaps. It doesn't call a model itself. The model comes from the agent framework you plug AgentKit into: LangChain (what create-onchain-agent generates), Vercel AI SDK or OpenAI Agents SDK. To run AgentKit on TeamoRouter, point that framework's OpenAI or Anthropic client at TeamoRouter and use your TeamoRouter API key. One key and one balance cover GPT and Claude.
Checked on 2026-11-08 with the packages the LangChain template uses (@langchain/openai 1.8.2, @langchain/anthropic 1.6.1) and Vercel AI SDK 4.3: requests reach TeamoRouter's /v1/chat/completions and /v1/messages.
1. Before you start
- Create an API key in the TeamoRouter console.
- Have an AgentKit project. If you don't have one yet:
npm create onchain-agent@latest
For Python, use pipx run create-onchain-agent.
2. GPT models: one environment variable
The LangChain template creates the model with new ChatOpenAI(...). The OpenAI client reads OPENAI_BASE_URL, so you only change .env and the model ID.
.env:
OPENAI_API_KEY=sk-teamo-xxxxxx
OPENAI_BASE_URL=https://api.teamorouter.com/v1
Then set the model in the generated agent file:
const llm = new ChatOpenAI({ model: "gpt-6.1-sol" });
- Keep
/v1at the end ofOPENAI_BASE_URL. - Python (
coinbase-agentkitwithlangchain-openai): pass the base URL explicitly:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-6.1-sol", base_url="https://api.teamorouter.com/v1", api_key="sk-teamo-xxxxxx")
3. Claude models: native Anthropic endpoint
Claude also works through ChatOpenAI, but prompt caching may not apply in that format. Use the Anthropic client instead:
npm install @langchain/anthropic
import { ChatAnthropic } from "@langchain/anthropic";
const llm = new ChatAnthropic({
model: "claude-sonnet-5-5",
apiKey: process.env.TEAMOROUTER_API_KEY,
anthropicApiUrl: "https://api.teamorouter.com",
});
- No
/v1here. The Anthropic client adds/v1/messagesitself. You can also setANTHROPIC_BASE_URL=https://api.teamorouter.cominstead ofanthropicApiUrl. - Python:
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(model="claude-sonnet-5-5", base_url="https://api.teamorouter.com", api_key="sk-teamo-xxxxxx")
Pass llm to the agent the template builds (createReactAgent / create_react_agent) as before. The AgentKit tools don't change.
4. Other frameworks AgentKit supports
- Vercel AI SDK:
createOpenAI({ baseURL: "https://api.teamorouter.com/v1", apiKey })for GPT;createAnthropic({ baseURL: "https://api.teamorouter.com/v1", apiKey })for Claude. WithcreateAnthropic, keep/v1— without it the request goes to/messagesand returns 404. - OpenAI Agents SDK (Python): set
OPENAI_BASE_URL=https://api.teamorouter.com/v1and callset_tracing_disabled(True), so the SDK doesn't try to upload traces to OpenAI with your TeamoRouter key.
5. Which model for which job
| Job | Model ID | Official price (input / output per 1M tokens) |
|---|---|---|
| Main agent: tool calls, onchain actions | claude-sonnet-5-5 |
$2 / $10 |
| Hardest reasoning and long tasks | claude-opus-5-5 |
$4 / $20 |
| Main model on GPT | gpt-6.1-sol |
$2 / $10 |
| Cheap small model (routing, summaries) | claude-haiku-5-5 or gpt-6-luna |
$0.1 / $0.5 |
These are the vendors' official list prices. TeamoRouter's current prices are on the pricing page and the model list.
6. Common errors
| What you see | Cause | Fix |
|---|---|---|
| 401, API key incomplete | Key copied with missing characters | Copy the full sk-teamo- key again |
| 402 (400 on the OpenAI format), wallet balance is insufficient | Balance is $0 | Top up, from $5 |
| Redirect (301), an HTML page or 405 instead of a model reply | OPENAI_BASE_URL missing /v1 |
https://api.teamorouter.com/v1 |
404 with Vercel AI SDK createAnthropic |
baseURL missing /v1 |
https://api.teamorouter.com/v1 (only ChatAnthropic takes the address without /v1) |
| The agent still calls OpenAI | OPENAI_BASE_URL not loaded |
Check the variable is in the .env the agent reads, or pass the base URL in code |