API by router
Credits
Credit Check
Pre-call credit gate for VPS agents.
- Verify instance identity (mTLS)
- Determine server-side key_source
- Check tier guardrails
- Reserve credits (hold)
"Do you feel lucky, punk?" — Harry Callahan (about credit checks)
Path Parameters
instance_idInstance Id
Format
uuidconversation_id?Conversation Id
estimated_tokens_inEstimated Tokens In
Range
0 <= value <= 200000estimated_tokens_outEstimated Tokens Out
Range
0 <= value <= 200000key_source?Key Source
Default
"platform"Match
^(platform|tenant|end_user)$modelModel
Length
1 <= length <= 100request_idRequest Id
Length
1 <= length <= 64Response Body
curl -X POST "https://loading/internal/v1/instances/497f6eca-6276-4993-bfeb-53cbbbba6f08/credit-check" \ -H "Content-Type: application/json" \ -d '{ "estimated_tokens_in": 200000, "estimated_tokens_out": 200000, "model": "string", "request_id": "string" }'{
"allowed": true,
"byok_exempt": false,
"credits_held": 0,
"credits_remaining": 0,
"hold_id": "string",
"message": "string",
"retry_after_seconds": 0,
"server_key_source": "platform",
"tier_limits": {
"api_calls_remaining_monthly": 0,
"max_tokens_per_request": 0,
"requests_remaining_this_minute": 0,
"requests_remaining_today": 0,
"token_allowance_remaining_monthly": 0
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}Credit Release
Release a credit hold when the LLM call failed or was cancelled.
Called by the VPS agent when all providers fail so credits aren't stranded until the stale hold cleanup task runs (30 min).
"Game over, man! Game over!" — Hudson, Aliens (about releasing holds after provider failures)
Path Parameters
instance_idInstance Id
Format
uuidhold_idHold Id
Length
1 <= length <= 64request_idRequest Id
Length
1 <= length <= 64Response Body
curl -X POST "https://loading/internal/v1/instances/497f6eca-6276-4993-bfeb-53cbbbba6f08/credit-release" \ -H "Content-Type: application/json" \ -d '{ "hold_id": "string", "request_id": "string" }'{
"message": "string",
"released": true
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}