For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordPlatform
DocumentationIntegrationsAPI referenceSDKsChangelog
DocumentationIntegrationsAPI referenceSDKsChangelog
    • Overview
  • Tracing
  • Gateway
      • OpenAI Agents
      • Claude Agent SDK
      • Vercel AI SDK
      • Pydantic AI
      • CrewAI
      • Haystack
      • LangChain
      • LangGraph
      • Langflow
      • LlamaIndex
      • AutoGen
      • DSPy
      • Google ADK
      • Smolagents
      • Strands Agents
      • AgentSpec
      • Guardrails
      • Agno
      • MCP
      • BeeAI
      • Pipecat
      • Superagent
  • Others
  • Migrating
    • Braintrust
    • Portkey
    • Langfuse
LogoLogo
DiscordPlatform
On this page
  • Setup
  • Switch models
GatewayAgent Frameworks

Claude Agent SDK (gateway)

Was this page helpful?
Previous

Vercel AI SDK (gateway)

Next
Built with

Route Claude Agent SDK calls through the Respan gateway. Only your RESPAN_API_KEY is needed — no separate ANTHROPIC_API_KEY required.

Setup

1

Install packages

$pip install claude-agent-sdk respan-ai respan-instrumentation-claude-agent-sdk
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

No ANTHROPIC_API_KEY needed — the Respan gateway handles provider authentication.

3

Point Claude Agent SDK to the Respan gateway

1import os
2import asyncio
3
4import claude_agent_sdk
5from claude_agent_sdk import ClaudeAgentOptions, ResultMessage
6
7respan_api_key = os.environ["RESPAN_API_KEY"]
8respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")
9
10async def main():
11 options = ClaudeAgentOptions(
12 model="sonnet",
13 max_turns=1,
14 env={
15 "ANTHROPIC_API_KEY": respan_api_key,
16 "ANTHROPIC_AUTH_TOKEN": respan_api_key,
17 "ANTHROPIC_BASE_URL": f"{respan_base_url}/anthropic",
18 },
19 )
20
21 async for message in claude_agent_sdk.query(
22 prompt="Explain tracing in one sentence.",
23 options=options,
24 ):
25 if isinstance(message, ResultMessage):
26 print(message.result)
27
28asyncio.run(main())

Switch models

Change the model parameter to use different Claude models through the same gateway.

1options = ClaudeAgentOptions(model="claude-sonnet-4-5-20250929", ...)
2options = ClaudeAgentOptions(model="claude-3-5-haiku-20241022", ...)
3options = ClaudeAgentOptions(model="claude-3-opus-20240229", ...)

See the full model list.