Developer Hub
Everything developers need to integrate with Aforo — SDKs, code samples, the API simulator, live event stream, and integration diagnostics.
Developer Hub
The Developer Hub is where your customers (and your team) get everything needed to integrate with your API products — from quick-start code snippets to live event testing.
Integration Tiers
The Developer Hub organizes integrations into five tiers:
Gateway Plugins
Aforo ships production-ready plugins for all major API gateways:
All plugins:
- Auto-detect MCP
tools/callJSON-RPC requests and extracttool_name+agent_id - Buffer events locally and batch-flush to usage-ingestor
- Include exponential backoff with 3 retries
- Handle gateway restarts without losing buffered events
SDK — Node.js
npm install @aforo/metering
import { AforoClient } from '@aforo/metering'
const aforo = new AforoClient({
tenantId: process.env.AFORO_TENANT_ID,
apiKey: process.env.AFORO_API_KEY,
productId: 'prod_my_api',
})
// Wrap your route handler
app.use(aforo.middleware())
// Or record events directly
await aforo.ingest({
customerId: req.user.customerId,
metricId: 'api-calls',
quantity: 1,
})
SDK — Python
pip install aforo-metering
from aforo_metering import AforoClient
aforo = AforoClient(
tenant_id=os.getenv("AFORO_TENANT_ID"),
api_key=os.getenv("AFORO_API_KEY"),
product_id="prod_my_api"
)
# FastAPI middleware
app.add_middleware(aforo.middleware())
# Or record directly
await aforo.ingest(
customer_id=request.user.customer_id,
metric_id="api-calls",
quantity=1
)
MCP Server SDKs
For MCP Server products, use the dedicated MCP metering SDKs:
// Node.js MCP SDK
import { billing } from '@aforo/mcp-metering'
server.tool("search", schema, billing.wrapToolHandler(async (args) => {
// your tool implementation
return { results: [...] }
}))
The SDK automatically records tool name, agent ID, execution duration, and status.
API Simulator
The API Simulator (Developer Hub → API Simulator) is a request builder for exercising any Aforo endpoint against live services without leaving the console:
- Pick an endpoint from the reference tree, then fill path parameters (
{id},{customerId}) and query parameters in dedicated inputs — a live URL preview shows exactly what will be sent. Send stays disabled until every required path parameter is filled, so you never accidentally fire a request with a{placeholder}still in the URL. - Set the tenant id, extra headers, and a JSON body; your bearer token is injected automatically.
- Run the request and inspect the status code, timing, and response body.
- On a
4xx/5xx, an inline troubleshooting panel maps the status to the likely cause and fix (missing token, unfilled path parameter, wrong verb, rate limit, …).
The environment toggle controls write safety:
The simulator runs against live services; there is no isolated sandbox host yet, which is why Sandbox mode enforces read-only rather than implying isolation.
For the customer-facing try-it sandbox with multi-language code samples and saved request collections, see Sandbox Config.
Live Event Stream
Watch your usage events arrive in real time:
- Connect via SSE to
/v1/ingest/stream - Events appear within 2 seconds of ingestion
- Filter by customer, product, or event type
- Diagnose integration issues without reading logs
Integration Diagnostics
The Integration Diagnosis tool checks your integration health:
✓ Auth token valid
✓ Events received in last 24 hours
✓ No schema errors detected
⚠ 3 events with missing customerId field
✗ Last event 6 hours ago — expected frequency: 1/minute
Run a diagnostic:
Webhook Sources
If your data originates from third-party webhooks (Stripe, Twilio, SendGrid, GitHub, Slack), configure a Webhook Source to ingest those events as Aforo usage events:
- Go to Developer Hub → Webhook Sources
- Select a template or create custom
- Configure JSONPath extraction rules
- Copy the Aforo webhook receiver URL
- Paste it as the webhook destination in the third-party service