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

Guardrails (gateway)

Was this page helpful?
Previous

Agno (gateway)

Next
Built with

Route Guardrails’ underlying LLM calls through the Respan gateway to use 250+ models from different providers. Only your RESPAN_API_KEY is needed — no separate provider keys required.

Setup

1

Install packages

$pip install respan-ai respan-instrumentation-guardrails guardrails-ai
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export OPENAI_API_KEY="YOUR_RESPAN_API_KEY"
$export OPENAI_BASE_URL="https://api.respan.ai/api"

No real OpenAI key needed — the Respan gateway handles provider authentication.

3

Run your guard

1import os
2from typing import Literal
3
4os.environ["OPENAI_API_KEY"] = os.environ["RESPAN_API_KEY"]
5os.environ["OPENAI_BASE_URL"] = "https://api.respan.ai/api"
6
7from guardrails import Guard
8from pydantic import BaseModel, Field
9
10
11class SupportReply(BaseModel):
12 answer: str = Field(description="Customer-facing answer")
13 priority: Literal["low", "medium", "high"] = Field(description="Ticket priority")
14
15
16guard = Guard.for_pydantic(output_class=SupportReply)
17
18result = guard(
19 model="gpt-4o-mini",
20 messages=[
21 {
22 "role": "user",
23 "content": "Return JSON with answer and priority for a delayed shipment.",
24 }
25 ],
26)
27print(result.validated_output)

Switch models

Change the model parameter on guard(...) to use 250+ models from different providers through the same gateway.

1result = guard(model="claude-sonnet-4-5", messages=messages)
2result = guard(model="gemini-2.5-flash", messages=messages)

See the full model list.