Skip to main content
The Claude Agent SDK from Anthropic (available for TypeScript as @anthropic-ai/claude-agent-sdk and for Python as claude-agent-sdk) lets you build AI agents with tool calling, hooks, and MCP server support. This page shows how to point the SDK at Requesty so your agents can use 300+ models from multiple providers. For the SDK’s own API reference (hooks, tool definitions, MCP configuration, TypeScript interfaces), see Anthropic’s official Agent SDK documentation. Using the Requesty integration, you can:
  • Use 300+ models while building agents, giving you flexibility to choose the best model for each task
  • Track and manage your spend in a single location
  • Keep a record of your agent interactions

Configuration

Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN

The Claude Agent SDK reads the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN environment variables, so the easiest way to integrate Requesty is:
  1. Get Your API Key Create an API key on the API Keys Page.
  2. Set Environment Variables
    export ANTHROPIC_BASE_URL="https://router.requesty.ai"
    export ANTHROPIC_AUTH_TOKEN="your_requesty_api_key"
    export ANTHROPIC_MODEL="anthropic/claude-fable-5"
    
With this setup, the Agent SDKs will route all requests through Requesty, giving you access to models from OpenAI, Anthropic, Google, Mistral, and many more providers.

Model Selection

You can choose any model from the Model Library or any policy configured for your organization. Standard model IDs follow the format provider/model-name:
  • anthropic/claude-fable-5
  • openai/gpt-5
  • google/gemini-2.5-flash
  • mistral/mistral-large-latest
Policies follow the format policy/policy-name:
  • policy/reliable-sonnet-4-5

TypeScript

The TypeScript Agent SDK (@anthropic-ai/claude-agent-sdk) automatically respects the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN environment variables.
import { query } from '@anthropic-ai/claude-agent-sdk';

// Set environment variables before importing
// ANTHROPIC_BASE_URL=https://router.requesty.ai
// ANTHROPIC_AUTH_TOKEN=your_requesty_api_key

for await (const message of query({
  prompt: 'Your prompt here',
  options: {
    systemPrompt: 'You are a helpful assistant.',
  },
})) {
  // Handle messages
  if (message.type === 'assistant') {
    console.log(message.message.content);
  }
}

Python

The Python Agent SDK (claude-agent-sdk) automatically respects the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN environment variables.
"""Minimal agent using Claude Agent SDK."""
import os
import asyncio

from claude_agent_sdk import (
    ClaudeSDKClient,
    ClaudeAgentOptions,
    tool,
    create_sdk_mcp_server,
    AssistantMessage,
    TextBlock,
)

os.environ["ANTHROPIC_BASE_URL"] = "https://router.requesty.ai"
# ANTHROPIC_AUTH_TOKEN should be set as an environment variable


async def main():
    @tool("greet", "Greet a user", {"name": str})
    async def greet_user(args):
        return {
            "content": [
                {"type": "text", "text": f"Hello, {args['name']}!"}
            ]
        }

    server = create_sdk_mcp_server(
        name="my-tools",
        version="1.0.0",
        tools=[greet_user]
    )

    options = ClaudeAgentOptions(
        mcp_servers={"tools": server},
        allowed_tools=["mcp__tools__greet"]
    )

    async with ClaudeSDKClient(options=options) as client:
        await client.query("Greet World")
        
        last_assistant_message = None
        async for msg in client.receive_response():
            if isinstance(msg, AssistantMessage):
                last_assistant_message = msg

        if last_assistant_message:
            print(last_assistant_message.content[0].text)


if __name__ == "__main__":
    asyncio.run(main())

Looking for the Agent SDK API reference?

This page covers routing the SDK through Requesty. For the SDK itself, Anthropic maintains the official documentation: Everything in those docs works unchanged through Requesty. Only the base URL and auth token differ.

Benefits of Using Requesty with Agent SDKs

Access 300+ Models

Switch between models from different providers without changing your setup

Cost Management

Monitor spending and set limits across all your AI interactions

Fallback Policies

Automatic fallbacks ensure your agents never get interrupted

Unified Interface

Use the same SDK interface with models from multiple providers

Troubleshooting

Model Not Found

If you get a “model not found” error, make sure:
  • Your API key is valid and has access to the model (check the approved models in your organization)
  • The model ID format is correct (provider/model-name)
  • The model is available in the Model Library

Connection Issues

If the Agent SDK can’t connect:
  • Verify your ANTHROPIC_BASE_URL is set to https://router.requesty.ai
  • Check your ANTHROPIC_AUTH_TOKEN is correct
  • Ensure you have internet connectivity
  • For TypeScript, make sure environment variables are set before importing the SDK
Last modified on June 12, 2026