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.
Key Takeaways
- ActivePieces shows flow runs, not AI costs — you need external metering for cost visibility
- 32% of cloud spend is wasted, and AI API costs are a growing contributor (Flexera, 2025)
- Setup: replace the OpenAI endpoint in the HTTP piece with the Tokonomics proxy URL — one change, full metering
- Works on both cloud and self-hosted ActivePieces — tag flows for per-automation cost tracking
Why Do 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. According to Flexera's 2025 State of the Cloud Report, 32% of cloud spend is wasted, and AI API costs are a growing contributor to that waste.
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. A Deloitte survey on AI adoption (2024) found that 42% of organizations cited cost management as a top barrier to scaling AI. Without visibility, there's no way to know where the money goes.
How Do You Set Up the 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.
How Do You Use 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.
How Do You Track Cost Per Flow?
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"}
Why Is ActivePieces + Tokonomics a Great 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. McKinsey's State of AI 2024 found that 72% of organizations now use AI in at least one business function, with automation workflows among the fastest-growing deployment patterns — making per-flow cost attribution a critical operational capability rather than a nice-to-have.
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.
How Do You Optimize Automation Workflow Costs?
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. Research from Stanford HAI's 2024 AI Index Report shows that model training and inference costs have dropped roughly 10x year-over-year, making smaller models increasingly viable for routine tasks.
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. The FinOps Foundation's 2024 State of FinOps report found that teams with proactive budget alerts reduce cloud cost overruns by an average of 28% compared to teams relying on end-of-month invoice reviews.
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. Key external sources: Flexera 2025 State of the Cloud | Deloitte State of Generative AI 2024 | Stanford HAI AI Index 2024 | McKinsey State of AI 2024 | FinOps Foundation State of FinOps 2024.