AgentBill icon

AgentBill

Interact with AgentBill API for AI usage tracking & billing

Actions16

Overview

This node interacts with the AgentBill API to validate AI requests against budget limits before spending. It is useful for managing and controlling AI usage costs by checking if a request fits within daily or monthly budget constraints. For example, it can be used to prevent exceeding allocated budgets for AI model usage in applications that rely on AI-generated content or chatbots.

Use Case Examples

  1. Validate an AI chat request by providing customer ID, AI model, chat messages, estimated input/output tokens, and optional budget overrides to ensure the request is within budget before execution.
  2. Use it to monitor and control AI usage costs in real-time by validating requests before they are sent to AI providers.

Properties

Name Meaning
Customer ID Your customer identifier (max 255 characters)
Model AI model name (e.g., gpt-4o-mini, claude-sonnet-4-5)
Messages (JSON) Chat messages array in JSON format
Estimated Input Tokens Estimated input tokens (~4 chars per token)
Estimated Output Tokens Expected max output tokens
Daily Budget Override Optional daily budget limit in USD (0 = use account default)
Monthly Budget Override Optional monthly budget limit in USD (0 = use account default)

Output

JSON

  • estimated_cost - Estimated cost of the AI request in USD
  • valid - Boolean indicating if the request is within budget limits
  • message - Additional message or information about the validation result

Dependencies

  • AgentBill API key credential

Troubleshooting

  • Ensure Customer ID is provided and does not exceed 255 characters; otherwise, the node throws an error.
  • Model name must be provided and be less than 100 characters.
  • Messages must be a valid JSON array; invalid JSON will cause an error.
  • If the API key credential is missing or invalid, the node will fail to authenticate with the AgentBill API.
  • Network issues or incorrect base URL configuration can cause HTTP request failures.

Links

Discussion