OpenAI Responses API
OpenAI Responses API: a hosted mcp tool — OpenAI calls aicharged.io for you; the key goes into the authorization field.
- API key (Bearer)
Hosted MCP tool — the API calls aicharged.io for you
Recommendedimport 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
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"}]
}'