AiCredential ai.credential@1

Generated at from openvibe-contracts v0.76.0 and openvibe-sdk v0.20.1.

Version
1.0.0
Owner
ai
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/ai/credential.v1.json

ai.credential@1 (OpenVibe.AI; roadmap WS-O task 2): a stored credential as its owner service reads it (GET or PUT /api/v1/credentials/{subject}): never the key, only its last four characters.

Fields

FieldTypeRequiredDescriptionConstraints
subjectstringyes
  • pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
ownerstringyesThe service that stored it; only it may use or change it.
  • pattern ^[a-z][a-z0-9-]{1,31}$
providerenumyes
  • one of "openai", "anthropic"
base_urlstring | null
  • maxLength 300
key_hintstringyes
  • pattern ^…[\s\S]{1,4}$
modelsobjectModel per Live role; `chat` is the default for the others.
  • no other fields
models.chatstring
  • minLength 1
  • maxLength 120
models.visionstring
  • minLength 1
  • maxLength 120
models.directorstring
  • minLength 1
  • maxLength 120
models.summarystring
  • minLength 1
  • maxLength 120
models.legacystring
  • minLength 1
  • maxLength 120
budget_usd_per_daynumber | null
  • minimum 0
spent_usd_todaynumber
  • minimum 0
created_atstringyes
  • format date-time
updated_atstringyes
  • format date-time
last_used_atstring | null
  • format date-time

Examples

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

Valid: stored
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "owner": "live",
  "provider": "openai",
  "base_url": "https://openrouter.ai/api/v1",
  "key_hint": "…MPLE",
  "models": {
    "chat": "gpt-4o-mini"
  },
  "budget_usd_per_day": 2,
  "spent_usd_today": 0.12,
  "created_at": "2026-09-28T00:00:00.000Z",
  "updated_at": "2026-09-28T00:00:00.000Z",
  "last_used_at": null
}
Rejected: leaks-key
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "owner": "live",
  "provider": "openai",
  "api_key": "sk-EXAMPLE",
  "key_hint": "…MPLE",
  "created_at": "2026-09-28T00:00:00.000Z",
  "updated_at": "2026-09-28T00:00:00.000Z"
}

Validate

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