Skip to main content
The Anthropic Agent SDKs (TypeScript and Python) allow you to build AI agents with tool calling capabilities. Using the Requesty integration, you can route all agent requests through Requesty to access 300+ models from multiple providers. 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

Environment Variables Setup

The easiest way to integrate Requesty with the Anthropic Agent SDKs is through environment variables:
  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-sonnet-4-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-4-5-sonnet
  • 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())

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