HydraCore
API by router

Credits

Credit Check

Pre-call credit gate for VPS agents.

  1. Verify instance identity (mTLS)
  2. Determine server-side key_source
  3. Check tier guardrails
  4. Reserve credits (hold)

"Do you feel lucky, punk?" — Harry Callahan (about credit checks)

POST
/internal/v1/instances/{instance_id}/credit-check

Path Parameters

instance_idInstance Id
Formatuuid
conversation_id?Conversation Id
estimated_tokens_inEstimated Tokens In
Range0 <= value <= 200000
estimated_tokens_outEstimated Tokens Out
Range0 <= value <= 200000
key_source?Key Source
Default"platform"
Match^(platform|tenant|end_user)$
modelModel
Length1 <= length <= 100
request_idRequest Id
Length1 <= length <= 64

Response 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)

POST
/internal/v1/instances/{instance_id}/credit-release

Path Parameters

instance_idInstance Id
Formatuuid
hold_idHold Id
Length1 <= length <= 64
request_idRequest Id
Length1 <= length <= 64

Response 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"
    }
  ]
}