BillingCreditHoldSettleRequest billing.credit-hold-settle-request@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
billing
Visibility
internal
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/billing/credit-hold-settle-request.v1.json

billing.credit-hold-settle-request@1: body of POST /internal/credits/holds/:id/settle. Idempotent: the same key and fingerprint return the same settlement.

Fields

FieldTypeRequiredDescriptionConstraints
idempotency_keystringyes
  • pattern ^[A-Za-z0-9._:-]{8,128}$
usageobjectyes
  • no other fields
usage.input_tokensintegeryes
  • minimum 0
usage.cached_read_tokensintegeryes
  • minimum 0
usage.cache_write_tokensintegeryes
  • minimum 0
usage.output_tokensintegeryes
  • minimum 0
retailobjectyes
  • no other fields
retail.versionstringyes
retail.nano_usd_per_mobjectyes
  • no other fields
retail.nano_usd_per_m.inputhttps://openvibe.network/contracts/billing/credit-hold-settle-request.v1.json#/$defs/money-nano-usdyes
retail.nano_usd_per_m.cached_readhttps://openvibe.network/contracts/billing/credit-hold-settle-request.v1.json#/$defs/money-nano-usdyes
retail.nano_usd_per_m.cache_writehttps://openvibe.network/contracts/billing/credit-hold-settle-request.v1.json#/$defs/money-nano-usdyes
retail.nano_usd_per_m.outputhttps://openvibe.network/contracts/billing/credit-hold-settle-request.v1.json#/$defs/money-nano-usdyes
retail.per_request_nano_usdhttps://openvibe.network/contracts/billing/credit-hold-settle-request.v1.json#/$defs/money-nano-usdyes
supply_cost_nano_usdhttps://openvibe.network/contracts/billing/credit-hold-settle-request.v1.json#/$defs/money-nano-usdyes
byokbooleanyes
attemptsarray of objectyes
  • items: no other fields
attempts[].deployment_idstringyes
attempts[].provider_accessenum
  • one of "OWN_DEPLOYMENT", "AUTHORIZED_WHOLESALE", "CUSTOMER_BYOK", "RESTRICTED", "UNVERIFIED"
attempts[].started_atstringyes
  • format date-time
attempts[].ended_atstringyes
  • format date-time
attempts[].error_codestring | null

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: byok
{
  "idempotency_key": "settle-key-002",
  "usage": {
    "input_tokens": 500,
    "cached_read_tokens": 0,
    "cache_write_tokens": 0,
    "output_tokens": 200
  },
  "retail": {
    "version": "rr-2026-11-03-001",
    "nano_usd_per_m": {
      "input": "0",
      "cached_read": "0",
      "cache_write": "0",
      "output": "0"
    },
    "per_request_nano_usd": "0"
  },
  "supply_cost_nano_usd": "0",
  "byok": true,
  "attempts": [
    {
      "deployment_id": "dep-owner-byok",
      "provider_access": "CUSTOMER_BYOK",
      "started_at": "2026-11-03T00:00:01.000Z",
      "ended_at": "2026-11-03T00:00:04.000Z",
      "error_code": null
    }
  ]
}
Valid: full
{
  "idempotency_key": "settle-key-001",
  "usage": {
    "input_tokens": 1000,
    "cached_read_tokens": 0,
    "cache_write_tokens": 0,
    "output_tokens": 500
  },
  "retail": {
    "version": "rr-2026-11-03-001",
    "nano_usd_per_m": {
      "input": "3000",
      "cached_read": "300",
      "cache_write": "3000",
      "output": "15000"
    },
    "per_request_nano_usd": "0"
  },
  "supply_cost_nano_usd": "9000",
  "byok": false,
  "attempts": [
    {
      "deployment_id": "dep-qwen-9b-us-east-001",
      "provider_access": "OWN_DEPLOYMENT",
      "started_at": "2026-11-03T00:00:01.000Z",
      "ended_at": "2026-11-03T00:00:05.000Z",
      "error_code": null
    }
  ]
}
Rejected: missing-key
{
  "usage": {
    "input_tokens": 1000,
    "cached_read_tokens": 0,
    "cache_write_tokens": 0,
    "output_tokens": 500
  },
  "retail": {
    "version": "rr-2026-11-03-001",
    "nano_usd_per_m": {
      "input": "3000",
      "cached_read": "300",
      "cache_write": "3000",
      "output": "15000"
    },
    "per_request_nano_usd": "0"
  },
  "supply_cost_nano_usd": "9000",
  "byok": false,
  "attempts": []
}
Rejected: missing-usage
{
  "idempotency_key": "settle-key-001",
  "retail": {
    "version": "rr-2026-11-03-001",
    "nano_usd_per_m": {
      "input": "3000",
      "cached_read": "300",
      "cache_write": "3000",
      "output": "15000"
    },
    "per_request_nano_usd": "0"
  },
  "supply_cost_nano_usd": "9000",
  "byok": false,
  "attempts": []
}
Rejected: money-number
{
  "idempotency_key": "settle-key-001",
  "usage": {
    "input_tokens": 1000,
    "cached_read_tokens": 0,
    "cache_write_tokens": 0,
    "output_tokens": 500
  },
  "retail": {
    "version": "rr-2026-11-03-001",
    "nano_usd_per_m": {
      "input": "3000",
      "cached_read": "300",
      "cache_write": "3000",
      "output": 15000
    },
    "per_request_nano_usd": "0"
  },
  "supply_cost_nano_usd": "9000",
  "byok": false,
  "attempts": []
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('billing.credit-hold-settle-request@1', value);   // { valid, errors: [{ path, message }] }