Agent tools

Web search, fetch, MCP and a code sandbox in one call.

Declare the tool your SDK already knows. The API runs it, hands the result back to the model and returns one answer with citations and a receipt for every round.

Live prices, per call
Web search
$0.01 a search
Web fetch
$0.001 a fetch
Code sandbox
$0.05 a container-hour, 1-minute minimum
Remote MCP tools
no fee, tokens only
Rounds per request
up to 8

What it does for an agent

Search and read the web
web_search finds pages, web_fetch reads one. Sources come back as url_citation annotations, Anthropic citations or Responses web_search_call items.
Run code
A sandbox that runs bash and JavaScript and python. Send the x-uplink-sandbox-session value back as session_id and the next request finds the same files.
Call any remote MCP server
OpenAI's mcp tool or Anthropic's mcp_servers: the API connects, lists the tools, calls them and feeds the answers to the model.
One request, many rounds
The loop runs on the API, up to max_tool_rounds or the x-uplink-max-tool-rounds header. Your agent code stays a single call.
A receipt per round
Each model round is billed and signed as its own request. x-uplink-round-ids lists them; x-uplink-total-charge is the whole bill.
Capped by the key
Tool fees count against the key's budget and monthly limit. At the limit the request stops with 402 and the rest of the account keeps running.

Copy, paste, run

The OpenAI and Anthropic SDKs, unchanged except for the base URL.

OpenAI SDK: search and fetch
python
1from openai import OpenAI
2import os
3
4client = OpenAI(
5 base_url="https://api.relayswitch.io/v1",
6 api_key=os.environ["RELAYSWITCH_API_KEY"],
7)
8
9resp = client.responses.create(
10 model="gpt-6.1-sol",
11 tools=[{"type": "web_search"}, {"type": "web_fetch"}],
12 input="What changed in the latest Node.js LTS release? Cite the notes.",
13 extra_body={"max_tool_rounds": 4},
14)
15print(resp.output_text) # url_citation annotations carry the sources
Anthropic SDK: search and run code
python
1import anthropic
2import os
3
4client = anthropic.Anthropic(
5 base_url="https://api.relayswitch.io/v1",
6 api_key=os.environ["RELAYSWITCH_API_KEY"],
7)
8
9reply = client.messages.create(
10 model="claude-sonnet-5-5",
11 max_tokens=2048,
12 tools=[
13 {"type": "web_search_20250305", "name": "web_search", "max_uses": 3},
14 {"type": "code_execution_20250825", "name": "code_execution"},
15 ],
16 messages=[{"role": "user", "content":
17 "Find this week's ETH and BTC closes, then compute the ratio in code."}],
18)
19for block in reply.content:
20 if block.type == "text":
21 print(block.text)
OpenAI SDK: remote MCP
python
1from openai import OpenAI
2import os
3
4client = OpenAI(
5 base_url="https://api.relayswitch.io/v1",
6 api_key=os.environ["RELAYSWITCH_API_KEY"],
7)
8
9resp = client.responses.create(
10 model="gpt-6.1-sol",
11 tools=[{
12 "type": "mcp",
13 "server_label": "docs",
14 "server_url": "https://mcp.example.com/mcp",
15 "headers": {"Authorization": "Bearer " + os.environ["DOCS_MCP_TOKEN"]},
16 "allowed_tools": ["search_docs"],
17 "require_approval": "never",
18 }],
19 input="How do I rotate a webhook secret? Answer from our docs.",
20)
21print(resp.output_text)
Anthropic SDK: remote MCP
python
1import anthropic
2import os
3
4client = anthropic.Anthropic(
5 base_url="https://api.relayswitch.io/v1",
6 api_key=os.environ["RELAYSWITCH_API_KEY"],
7)
8
9reply = client.messages.create(
10 model="claude-sonnet-5-5",
11 max_tokens=1024,
12 tools=[{"type": "mcp_toolset", "mcp_server_name": "docs"}],
13 messages=[{"role": "user", "content": "List the open incidents."}],
14 extra_body={"mcp_servers": [{
15 "type": "url",
16 "name": "docs",
17 "url": "https://mcp.example.com/mcp",
18 "authorization_token": os.environ["DOCS_MCP_TOKEN"],
19 }]},
20)
curl: what the call cost
bash
1curl -i https://api.relayswitch.io/v1/chat/completions \
2 -H "Authorization: Bearer $RELAYSWITCH_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "gpt-6.1-sol",
6 "web_search_options": {},
7 "messages": [{"role": "user", "content": "Latest stable Rust version?"}]
8 }'
9# x-uplink-tool-calls: searches run x-uplink-tool-charge: their fees
10# x-uplink-total-charge: every model round plus the tool fees
Sandbox files across requests
python
1# Keep the sandbox's files between requests: send back the
2# x-uplink-sandbox-session header value as the tool's session_id.
3tools=[{"type": "code_interpreter", "session_id": "SANDBOX_SESSION_ID"}]

Every server tool, priced live

Read from GET /v1/catalog at render.

ToolDeclare asPriceAvailable
Web searchuplink:web_search, web_search, web_search_preview, web_search_20250305$0.01 a searchYes
Web fetchuplink:web_fetch, web_fetch, web_fetch_20250910$0.001 a fetchYes
Code sandboxuplink:code_execution, code_interpreter, code_execution_20250825$0.05 a container-hour, 1-minute minimumYes
Remote MCP toolsuplink:mcp, mcp, mcp_serversno fee, tokens onlyYes
FAQs

Questions

For agent builders.

Open the console

A key in under a minute

Get a key

Or email hello@relayswitch.io

Give your agent the web and a sandbox

One key, one request per answer, every tool call priced on the receipt.