Use TeamoRouter with Solana Agent Kit
Solana Agent Kit gives an AI agent Solana actions: tokens, NFTs, DeFi, Blinks. It doesn't call a model itself. You turn its actions into tools for an agent framework (createVercelAITools, createLangchainTools, createOpenAITools or createClaudeTools), and that framework calls the model. To run it on TeamoRouter, point the framework's OpenAI or Anthropic client at TeamoRouter and use your TeamoRouter API key.
Checked on 2026-11-08 against solana-agent-kit 2.0.10 with the Vercel AI SDK version it uses (ai 4.3, @ai-sdk/openai 1.3, @ai-sdk/anthropic 1.2) and LangChain (@langchain/openai 1.8.2, @langchain/anthropic 1.6.1): requests reach TeamoRouter's /v1/chat/completions and /v1/messages.
1. Before you start
- Create an API key in the TeamoRouter console.
- Install the kit, the plugins you need and the Vercel AI SDK:
npm install solana-agent-kit @solana-agent-kit/plugin-token ai@4 @ai-sdk/openai@1 @ai-sdk/anthropic@1
The README example passes OPENAI_API_KEY in the SolanaAgentKit config. That field is optional and doesn't choose the agent's chat model, so you can leave it out. The chat model is the one you set below.
2. Vercel AI SDK: GPT and Claude
import { SolanaAgentKit, createVercelAITools, KeypairWallet } from "solana-agent-kit";
import TokenPlugin from "@solana-agent-kit/plugin-token";
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";
const agent = new SolanaAgentKit(wallet, process.env.RPC_URL!, {}).use(TokenPlugin);
const tools = createVercelAITools(agent, agent.actions);
const teamo = createOpenAI({
baseURL: "https://api.teamorouter.com/v1",
apiKey: process.env.TEAMOROUTER_API_KEY,
});
const { text } = await generateText({
model: teamo("gpt-6.1-sol"),
tools,
maxSteps: 5,
prompt: "What is my SOL balance?",
});
- Keep
/v1at the end ofbaseURL. - For Claude, use the native Anthropic endpoint so prompt caching works:
import { createAnthropic } from "@ai-sdk/anthropic";
const claude = createAnthropic({
baseURL: "https://api.teamorouter.com/v1",
apiKey: process.env.TEAMOROUTER_API_KEY,
});
const { text } = await generateText({ model: claude("claude-sonnet-5-5"), tools, maxSteps: 5, prompt: "..." });
With createAnthropic, keep /v1 — without it the request goes to /messages and returns 404.
3. LangChain
import { createLangchainTools } from "solana-agent-kit";
import { ChatOpenAI } from "@langchain/openai";
import { ChatAnthropic } from "@langchain/anthropic";
const tools = createLangchainTools(agent, agent.actions);
// GPT
const gpt = new ChatOpenAI({
model: "gpt-6.1-sol",
apiKey: process.env.TEAMOROUTER_API_KEY,
configuration: { baseURL: "https://api.teamorouter.com/v1" },
});
// Claude: no /v1 here, the Anthropic client adds /v1/messages itself
const claude = new ChatAnthropic({
model: "claude-sonnet-5-5",
apiKey: process.env.TEAMOROUTER_API_KEY,
anthropicApiUrl: "https://api.teamorouter.com",
});
Pass either model and tools to your LangChain agent (for example createReactAgent).
4. Claude Agent SDK
createClaudeTools gives you tools for the Claude Agent SDK. That SDK reads the same environment variables as Claude Code:
ANTHROPIC_BASE_URL=https://api.teamorouter.com
ANTHROPIC_AUTH_TOKEN=sk-teamo-xxxxxx
No /v1 in ANTHROPIC_BASE_URL.
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 | baseURL missing /v1 (OpenAI format) |
https://api.teamorouter.com/v1 |
404 with createAnthropic |
baseURL missing /v1 |
https://api.teamorouter.com/v1 (only ChatAnthropic and ANTHROPIC_BASE_URL take the address without /v1) |