# OpenAI API and Agents SDK

The Responses API's hosted MCP tool, or HostedMCPTool in the Agents SDK.

API key

## Setup

1.  1
    
    Responses API: declare the server as a tool with the key as authorization.
    
    ```python
    from openai import OpenAI
    import os
    
    client = OpenAI()
    response = client.responses.create(
        model="gpt-5",
        input="Who are the top commenters on r/python this week?",
        tools=[{
            "type": "mcp",
            "server_label": "zomler",
            "server_url": "https://api.zomler.com/mcp",
            "authorization": os.environ["ZOMLER_API_KEY"],
            "require_approval": "never",
        }],
    )
    ```
    
2.  2
    
    Agents SDK: the same server as a HostedMCPTool on the agent.
    
    **Agents SDK**
    
    ```
    from agents import Agent, HostedMCPTool
    
    agent = Agent(
        name="analyst",
        tools=[HostedMCPTool(tool_config={
            "type": "mcp",
            "server_label": "zomler",
            "server_url": "https://api.zomler.com/mcp",
            "authorization": os.environ["ZOMLER_API_KEY"],
            "require_approval": "never",
        })],
    )
    ```
    

## What you get

One tool per platform, plus `capabilities` and `check_balance`, at `https://api.zomler.com/mcp`. Every answer is [the envelope](https://zomler.com/docs/api/responses): what was measured, when, what was left out and why, and what it cost. Fresh fetches spend [credits](https://zomler.com/docs/api/credits); anything already held is free.

Keys are created under [API keys](https://app.zomler.com/api-keys) in the dashboard, where each one's calls and spend are listed. Revoking a key stops this client on its next call. The same key also calls the [REST API](https://zomler.com/docs/api).

[All clients](https://zomler.com/docs/mcp)

---

Source: https://zomler.com/docs/mcp/openai-api
