Estimate token count from text (or pass exact counts) and compute API cost at per-million prices.
Free tier eligible — 500 calls/month with a free key from /pricing; x402 pay-per-call above quota.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | optional | Text to estimate input tokens from (~4 chars/token) |
input_tokens | integer | optional | Exact input token count (overrides text estimate) |
output_tokens | integer | optional | Output token count |
price_per_1m_input | number | optional | USD price per 1,000,000 input tokens |
price_per_1m_output | number | optional | USD price per 1,000,000 output tokens (defaults to input price) |
calls | integer | optional | Number of identical calls to total (default 1) |
curl -s https://wingmanprotocol.com/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "token_cost", "arguments": {"text": "hello from an agent", "input_tokens": 10, "output_tokens": 10}}}'curl -s https://wingmanprotocol.com/tools/token_cost \
-H 'Content-Type: application/json' \
-d '{"text": "hello from an agent", "input_tokens": 10, "output_tokens": 10}'Edit the JSON and run it — this POSTs to https://wingmanprotocol.com/tools/token_cost from your browser.
X-Payment header, or get a free key at /pricing (500 calls/month, no card, no crypto).