TL;DR: ActivePieces' HTTP piece lets you call any API. Replace the OpenAI endpoint with
https://tokonomics.ca/proxy/openai/chat/completionsand use a Tokonomics API key. Every AI call is metered — cost per flow, per model, per day. Works on both cloud and self-hosted.
Why ActivePieces Users Need Cost Tracking
ActivePieces is an open-source Zapier alternative that's growing fast. It has AI pieces for OpenAI, and the HTTP piece can call any LLM provider. But like every automation platform, it shows you flow runs, not AI costs.
For self-hosted ActivePieces users, this is especially tricky. You chose ActivePieces to save money on automation — but the AI API costs running through it might be the biggest line item in your infrastructure budget. Without visibility, there's no way to know.
Setup: HTTP Piece
1. Add an HTTP Piece
In your ActivePieces flow:
- Add a new step → select HTTP Request piece
- Set Method:
POST - Set URL:
https://tokonomics.ca/proxy/openai/chat/completions
2. Configure Headers
| Header | Value |
|---|---|
Authorization |
Bearer mk_your_tokonomics_key |
Content-Type |
application/json |
X-Feature-Name |
your-flow-name |
3. Set the Body
{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "{{trigger.body.text}}"
}
],
"max_tokens": 500
}
Replace {{trigger.body.text}} with the actual ActivePieces variable from your trigger.
4. Test
Run the flow once. The response contains choices[0].message.content. Check the Tokonomics dashboard — the call appears with model, tokens, and cost.
Using Claude, DeepSeek, or Other Providers
Same HTTP piece, different URL:
| Provider | URL |
|---|---|
| OpenAI | https://tokonomics.ca/proxy/openai/chat/completions |
| Anthropic | https://tokonomics.ca/proxy/anthropic/messages |
| DeepSeek | https://tokonomics.ca/proxy/deepseek/chat/completions |
| Gemini | https://tokonomics.ca/proxy/gemini/v1beta/chat/completions |
| Mistral | https://tokonomics.ca/proxy/mistral/chat/completions |
All use the same Authorization: Bearer mk_... header. Full provider list at /docs.
Per-Flow Cost Attribution
Tag each flow with a unique X-Feature-Name:
| Flow | X-Feature-Name | Description |
|---|---|---|
| Lead classifier | lead-classifier |
Score incoming leads |
| Email responder | email-responder |
Draft replies to support emails |
| Content scheduler | content-scheduler |
Generate social posts |
The Tokonomics dashboard groups costs by tag, answering: "Which flow is costing me the most?"
For agencies or multi-tenant setups:
X-Metering-Tags: {"flow":"email-responder","client":"client-a","env":"prod"}
ActivePieces + Tokonomics: Open-Source Stack
Both ActivePieces and Tokonomics follow the same philosophy: you control your infrastructure. ActivePieces is self-hosted automation. Tokonomics is a managed proxy that gives you cost visibility without locking you in.
The combination:
- ActivePieces: your automation engine (self-hosted, no vendor lock-in)
- Tokonomics: your AI cost layer (managed proxy, hard spending caps prevent runaway bills)
- Your LLM provider: OpenAI, Anthropic, DeepSeek — switch anytime
If you ever want to remove Tokonomics, change the URL back to the provider's direct endpoint. No data migration. No SDK removal. One URL change.
Cost Optimization for Automation Workflows
1. Model-task matching
Most automation AI tasks are simple: classify, extract, summarize, format. These don't need GPT-4o ($2.50/1M input). GPT-4o-mini ($0.15/1M) or DeepSeek ($0.27/1M) handle them at 90%+ lower cost.
Check the cheapest LLM per use case guide.
2. Set max_tokens
Automation outputs are usually short — a classification label, a score, a one-sentence summary. Set max_tokens to 50-200 instead of the default. You pay per output token.
3. Budget alerts
Configure alerts at 70% and 90% of your monthly AI budget. For self-hosted ActivePieces with no centralized billing, this is your early warning system. See the budget alerts guide.
Frequently Asked Questions
Does this work with ActivePieces' native OpenAI piece?
The native OpenAI piece may not support custom base URLs. Use the HTTP piece instead — it gives you full control over the endpoint, headers, and body. The setup takes the same amount of time.
Can I use this on self-hosted ActivePieces?
Yes. The proxy is a URL. As long as your server can make outbound HTTPS requests, it works. No additional containers or dependencies needed.
How much latency does the proxy add?
About 30ms per call (benchmark). For automation workflows that run asynchronously, this is completely invisible.
Can I track ActivePieces + other platforms together?
Yes. Calls from ActivePieces, n8n, Make, and custom code all appear in the same Tokonomics dashboard.
Get Started
- Create a free Tokonomics account (100 calls/month free)
- Copy your API key
- Add an HTTP piece with the proxy URL
- Tag each flow with
X-Feature-Name - Run a test — check the dashboard
All sources retrieved June 2026. Pricing: GPT-4o at $2.50/1M input tokens (OpenAI Pricing), GPT-4o-mini at $0.15/1M input tokens.