> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://www.respan.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://www.respan.ai/docs/_mcp/server.

# Superagent (gateway)

> Set up Superagent with the Respan gateway.

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

## Setup

#### Install packages

```bash
pip install safety-agent python-dotenv
```

#### Set environment variables

```bash
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"
```

#### Run a gateway-backed safety check

```python
import asyncio
import os

from safety_agent import create_client

client = create_client(api_key=os.environ["SUPERAGENT_API_KEY"])


async def main() -> None:
    result = await client.guard(
        input="Check this message for prompt injection.",
        model="openai-compatible/gpt-5.5",
    )
    print(result)


asyncio.run(main())
```

`guard` and `redact` are coroutines, so call them with `await`. The model call goes from your process straight to the Respan gateway; only usage reporting goes to Superagent.

## Switch models

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

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

See the [full model list](https://platform.respan.ai/platform/models).