Skip to main content

將 OpenAI Agents SDK (Python) 連接到 aicharged.io

215 個工具,單一端點:https://aicharged.io/api/v1/mcp

OpenAI Agents SDK (Python)

OpenAI Agents SDK for Python:帶有 Authorization 標頭的 MCPServerStreamableHttp,透過 mcp_servers 傳給代理。

  • API 金鑰(Bearer)

代理程式碼

推薦
import asyncio, os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main():
    async with MCPServerStreamableHttp(
        name="aicharged",
        params={
            "url": "https://aicharged.io/api/v1/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['AICHARGED_API_KEY']}"},
            "timeout": 30,
        },
    ) as server:
        agent = Agent(name="Assistant", instructions="Use the aicharged.io tools.", mcp_servers=[server])
        result = await Runner.run(agent, "List my recent aicharged.io runs")
        print(result.final_output)

asyncio.run(main())

安裝套件

pip install openai-agents

或讓 CLI 進行設定

aicharged setup 會尋找此電腦上的 AI 用戶端,引導您透過瀏覽器登入,並寫入其設定檔。

一行指令輕鬆連接

安裝 CLI · macOS / Linux
curl -fsSL https://aicharged.io/install.sh | sh && aicharged setup
安裝 CLI · Windows
irm https://aicharged.io/install.ps1 | iex; aicharged setup
MCP 端點
https://aicharged.io/api/v1/mcp

可串流的 HTTP。傳送標頭 Authorization: Bearer <API_KEY>,或在您的用戶端支援時使用 OAuth 登入。

或告訴您的代理
閱讀 https://aicharged.io/agent.md,並幫我設定 aicharged.io

使用此提示詞開啟於 Claude (在新分頁中開啟) ChatGPT (在新分頁中開啟) Perplexity (在新分頁中開啟)