> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routeur.app/llms.txt
> Use this file to discover all available pages before exploring further.

# ChatGPT & the OpenAI Agents SDK

> Use Routeur as a hosted MCP tool from the Responses API, the Agents SDK, or ChatGPT connectors.

## Responses API

The model calls Routeur directly; no tool code of your own.

```python Python theme={null}
from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="gpt-5",
    tools=[{
        "type": "mcp",
        "server_label": "routeur",
        "server_url": "https://api.routeur.app/mcp",
        "headers": {"Authorization": f"Bearer {os.environ['ROUTEUR_API_KEY']}"},
        # Every Routeur tool is read-only; approval per call is optional.
        "require_approval": "never",
        "allowed_tools": [
            "find_opportunities", "compare_venues", "explain_relation",
            "market_snapshot", "search_markets",
        ],
    }],
    input="Which proven-equivalent markets are priced furthest apart across venues right now, and can any of them actually be filled?",
)

print(response.output_text)
```

`allowed_tools` is worth setting: Routeur exposes a tool per endpoint as well, and a short list keeps the model on the five that answer questions.

## Agents SDK

```python Python theme={null}
import asyncio, os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main():
    async with MCPServerStreamableHttp(
        name="routeur",
        params={
            "url": "https://api.routeur.app/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['ROUTEUR_API_KEY']}"},
        },
        cache_tools_list=True,
    ) as routeur:
        agent = Agent(
            name="Market analyst",
            instructions=(
                "You read prediction markets through Routeur. Prices are asks on a contract that pays $1. "
                "A relation is proven, never guessed. A gap between venues is only money when both books have "
                "size and fees leave something. Always name the venue and say how fresh the data is. "
                "Never give investment advice."
            ),
            mcp_servers=[routeur],
        )
        result = await Runner.run(agent, "Brief me on the December Fed decision market.")
        print(result.final_output)

asyncio.run(main())
```

`cache_tools_list=True` avoids listing the tools on every turn. Listing is free; the calls are what count against your key.

## ChatGPT connectors

In ChatGPT, add a custom connector under **Settings → Connectors → Add**, with the URL `https://api.routeur.app/mcp`. Where the connector form asks how to authenticate, choose a custom header and send `Authorization: Bearer <your key>`.

<Note>
  Connector support for header-authenticated MCP servers varies by plan and keeps changing; if your account only offers OAuth connectors, use the Responses API or the Agents SDK above, or [`mcp-remote`](/agents/clients#stdio-only-clients) locally. Routeur's server authenticates with API keys today — see [what OAuth would be for](/agents/overview#everything-is-read-only).
</Note>

## Cost control

`find_opportunities` reads up to four endpoints and `market_snapshot` five, so each such call spends that many requests from your key's quota. Give an agent a budget in its instructions ("at most three Routeur calls per answer"), and prefer `search_markets` then one `market_snapshot` over sweeping every category.
