ExchangeCompatRouting exchange.compat-routing@1

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

Version
1.0.0
Owner
exchange
Visibility
public
Status
active
Compatibility
backward
Decision
ADR-025
Schema
https://openvibe.network/contracts/exchange/compat-routing.v1.json

OpenRouter-compatible model fallback and provider policy controls. Prices are USD per million tokens.

Fields

FieldTypeRequiredDescriptionConstraints
modelstring
  • minLength 1
  • maxLength 256
modelsarray of string
  • minItems 1
  • maxItems 8
  • items: minLength 1
  • items: maxLength 256
providerobject
  • no other fields
provider.orderarray of string
  • maxItems 64
  • unique items
  • items: pattern ^[a-zA-Z0-9._-]{1,100}$
provider.onlyarray of string
  • maxItems 64
  • unique items
  • items: pattern ^[a-zA-Z0-9._-]{1,100}$
provider.ignorearray of string
  • maxItems 64
  • unique items
  • items: pattern ^[a-zA-Z0-9._-]{1,100}$
provider.allow_fallbacksboolean
provider.sortenum
  • one of "price", "throughput", "latency", "quality", "value"
provider.max_priceobject
  • no other fields
provider.max_price.promptnumber
  • minimum 0
provider.max_price.completionnumber
  • minimum 0
provider.data_collectionenum
  • one of "allow", "deny"
provider.zdrboolean
usageobject
  • no other fields
usage.includeboolean

Examples

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

Valid: example
{
  "model": "maker/model:free",
  "models": [
    "maker/backup"
  ],
  "provider": {
    "sort": "value",
    "zdr": true
  },
  "usage": {
    "include": true
  }
}
Rejected: example
{
  "provider": {
    "sort": "magic"
  }
}

Validate

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