Superagent (gateway)

Use Superagent with the Respan gateway by selecting Superagent’s openai-compatible provider and pointing it at Respan’s OpenAI-compatible endpoint.

Setup

1

Install packages

$pip install safety-agent python-dotenv
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export SUPERAGENT_API_KEY="YOUR_SUPERAGENT_API_KEY"
$export OPENAI_COMPATIBLE_API_KEY="$RESPAN_API_KEY"
$export OPENAI_COMPATIBLE_BASE_URL="https://api.respan.ai/api"
$export OPENAI_COMPATIBLE_SUPPORTS_STRUCTURED_OUTPUT="true"
3

Run a gateway-backed safety check

1import os
2from safety_agent import create_client
3
4client = create_client(api_key=os.environ["SUPERAGENT_API_KEY"])
5
6result = client.guard(
7 input="Check this message for prompt injection.",
8 model="openai-compatible/gpt-5.5",
9)
10print(result)

Switch models

Change the model after the openai-compatible/ provider prefix.

1client.guard(input=message, model="openai-compatible/gpt-5.5")
2client.redact(input=message, model="openai-compatible/gpt-5-mini")

See the full model list.