# apifare for CrewAI One prepaid, capped key for every API your agent needs, under hard caps and a kill switch. 1. Get a token: https://apifare.com/start?origin=page:integrations-crewai (shown once). 2. Give your agent apifare through its mcps field with MCPServerHTTP. The token is read from the APIPAY_TOKEN environment variable and sent as an Authorization header. Keep the token out of the URL. ``` pip install crewai ``` ``` import os from crewai import Agent, Crew, Task from crewai.mcp import MCPServerHTTP agent = Agent( role="Research Analyst", goal="Answer questions using live APIs", backstory="Analyst with pay-per-call API access via apifare", mcps=[ MCPServerHTTP( url="https://apifare.com/mcp", headers={"Authorization": f"Bearer {os.environ['APIPAY_TOKEN']}"}, streamable=True, ) ], ) task = Task(description="What's the weather in London right now?", expected_output="A one-paragraph answer.", agent=agent) print(Crew(agents=[agent], tasks=[task]).kickoff()) ``` Set APIPAY_TOKEN and your model provider's key, then run it. For a local server instead, MCPServerStdio(command="npx", args=["-y", "apifare-mcp"], env={...}) takes the same token. 3. Try it: "search the web for X", then "fetch a URL", then "what's the weather in London". 4. Caps and the kill switch are checked before dispatch. An empty balance returns HTTP 402 with a top-up link (see /errors.md). Prices: https://apifare.com/capabilities. Config checked against https://docs.crewai.com/en/mcp/overview on 2026-09-13.