# Connect OpenAI Responses API to aicharged.io

> OpenAI Responses API: a hosted mcp tool — OpenAI calls aicharged.io for you; the key goes into the authorization field.

## At a glance

| Kind | Sign-in | Platforms | Status | Verified |
|---|---|---|---|---|
| SDKs & frameworks | API key (Bearer) | macOS, Linux, Windows | works today | 2026-10-22 |

- MCP: `https://aicharged.io/api/v1/mcp`
- Docs: https://developers.openai.com/api/docs/guides/tools-connectors-mcp

## Recipe

Hosted MCP tool — the API calls aicharged.io for you:

```python
import os
from openai import OpenAI

client = OpenAI()
response = client.responses.create(
    model="gpt-6-astra",
    input="List my recent aicharged.io runs",
    tools=[{
        "type": "mcp",
        "server_label": "aicharged",
        "server_url": "https://aicharged.io/api/v1/mcp",
        "authorization": os.environ["AICHARGED_API_KEY"],
        "require_approval": "never",
    }],
)
print(response.output_text)
```

OpenAI never stores the authorization value — send it with every request.

The same request with curl:

```sh
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "input": "List my recent aicharged.io runs",
    "tools": [{"type": "mcp", "server_label": "aicharged", "server_url": "https://aicharged.io/api/v1/mcp", "authorization": "<API_KEY>", "require_approval": "never"}]
  }'
```

[Client documentation](https://developers.openai.com/api/docs/guides/tools-connectors-mcp)

## Authentication

- Send `Authorization: Bearer <API_KEY>` with every request. Create a key at https://aicharged.io/admin/account/api-keys.
- OAuth 2.1 (PKCE S256) is available for clients that cannot send a static key (ChatGPT).
- Without a key the endpoint answers 401 with a WWW-Authenticate header that points to https://aicharged.io/.well-known/oauth-protected-resource.

All 51 clients: https://aicharged.io/connect.md

HTML version: https://aicharged.io/connect/openai-responses-api
