/ AI Agent API
AI Agent API
REST API for AI agents. Save tokens by calling tools instead of generating code.
Authentication
# Pass API key in header: curl -H "x-api-key: tpx_your_key_here" https://toolpix.dev/api/v1/tokens # Or as query parameter: curl "https://toolpix.dev/api/v1/tokens?key=tpx_your_key_here" # Get your key at: https://toolpix.dev/console/api-keys
Endpoints
POST
/api/v1/tokensCount tokens for any text across models
Request:
{ "text": "Hello world", "models": ["gpt-4o", "claude"] }Response:
{ "gpt4o": { "tokens": 2, "cost": "$0.000005" }, "claude": { "tokens": 2, "cost": "$0.000006" } }POST
/api/v1/compress-prompt🔑 API Key requiredCompress prompts to save tokens
Request:
{ "prompt": "Please kindly provide a detailed explanation of..." }Response:
{ "optimized": "Explain...", "saved": "45%", "originalTokens": 120, "optimizedTokens": 66 }POST
/api/v1/regex🔑 API Key requiredGenerate regex from description
Request:
{ "description": "match email addresses" }Response:
{ "regex": "/[\\w.-]+@[\\w.-]+\\.\\w+/g", "explanation": "..." }POST
/api/v1/detect-ai🔑 API Key requiredDetect if text is AI-generated
Request:
{ "text": "The unprecedented paradigm shift..." }Response:
{ "score": 82, "verdict": "Likely AI", "confidence": "high" }POST
/api/v1/tone🔑 API Key requiredChange text tone
Request:
{ "text": "Hey dude, check this out", "tone": "formal" }Response:
{ "result": "I would like to draw your attention to the following..." }POST
/api/v1/templateFill prompt template with variables
Request:
{ "template": "blog-post", "variables": { "topic": "AI Safety" } }Response:
{ "prompt": "Write a blog post about AI Safety..." }GET
/api/v1/toolsList available API tools
Response:
{ "tools": [{ "slug": "regex", "description": "...", "method": "POST" }, ...] }Rate Limits
| Plan | AI calls/day | Requests/day | Price |
|---|---|---|---|
| Free | — | 5 | Free |
| Basic | 10 | 50 | $4.99/mo |
| Pro | 50 | 200 | $9.99/mo |
| Unlimited | 500 | 9,999 | $29.99/mo |