---
title: "common.resource-cost@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/common.resource-cost"
updated: null
---

# common.resource-cost@1 · OpenVibe.Services

HTML: [common.resource-cost@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/common.resource-cost)

# ResourceCost `common.resource-cost@1`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.0).

- Version: 1.0.0
- Owner: contracts
- Visibility: first-party
- Status: active
- Compatibility: backward
- Decision: [ADR-034](/docs/adr/ADR-034)
- Schema: [`https://openvibe.network/contracts/common/resource-cost.v1.json`](/docs/contracts/common.resource-cost.json)

One charge in weighted cost units (roadmap WS-Z1): which subject used what, reserved and committed or released, with an idempotency key so a retried charge counts once.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `subject` | [identity.subject-ref](/docs/contracts/identity.subject-ref) | yes |  |  |
| `project_id` | string |  |  | - `pattern ^prj_[0-9A-HJKMNP-TV-Z]{26}$` |
| `unit` | enum | yes |  | - `one of "browser-second", "ai-token", "ai-usd", "gpu-second", "video-minute", "bandwidth-byte", "storage-byte-day", "event", "watch-check", "bot-control-second", "job-run", "upload-byte", "download-byte"` |
| `amount` | number | yes |  | - `minimum 0` |
| `state` | enum | yes |  | - `one of "reserved", "committed", "released"` |
| `idempotency_key` | string | yes |  | - `minLength 8`<br>- `maxLength 200` |
| `service` | string | yes |  |  |
| `at` | string | yes |  | - `format date-time` |

## Examples

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

 Valid: browser-seconds

~~~~
{
  "subject": {
    "type": "agent",
    "id": "agt_01J0000000000000000000000A"
  },
  "project_id": "prj_01J0000000000000000000000A",
  "unit": "browser-second",
  "amount": 12.5,
  "state": "committed",
  "idempotency_key": "run_01J-step-4",
  "service": "actor",
  "at": "2026-09-28T23:00:00Z"
}
~~~~

Rejected: short-key

~~~~
{
  "subject": {
    "type": "user",
    "id": "usr_01J0000000000000000000000A"
  },
  "unit": "job-run",
  "amount": 1,
  "state": "reserved",
  "idempotency_key": "k",
  "service": "x",
  "at": "2026-09-28T23:00:00Z"
}
~~~~

Rejected: unknown-unit

~~~~
{
  "subject": {
    "type": "user",
    "id": "usr_01J0000000000000000000000A"
  },
  "unit": "coins",
  "amount": 1,
  "state": "committed",
  "idempotency_key": "abcdefgh",
  "service": "x",
  "at": "2026-09-28T23:00:00Z"
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('common.resource-cost@1', value);   // { valid, errors: [{ path, message }] }
~~~~
