Skip to main content
POST
/
v0
/
credits
/
deduct
curl --request POST \
  --url 'https://api.unify.ai/v0/credits/deduct' \
  --header "Authorization: Bearer $UNIFY_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
{
    "previous_credits": 10.0,
    "deducted": 2.5,
    "current_credits": 7.5
}
Deducts credits from the user’s account. The amount must be positive. The balance is allowed to go negative so that the spending-limit hook (which checks credit_balance <= 0) will correctly block subsequent LLM calls. If auto-recharge is configured, it is triggered after the deduction.

Authorizations

Authorization
string
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

amount
number
required
curl --request POST \
  --url 'https://api.unify.ai/v0/credits/deduct' \
  --header "Authorization: Bearer $UNIFY_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
{
    "previous_credits": 10.0,
    "deducted": 2.5,
    "current_credits": 7.5
}