ExchangeImageResult exchange.image-result@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/image-result.v1.json

Exchange API platform ExchangeImageResult response. Private account data is available only to its owner.

Fields

FieldTypeRequiredDescriptionConstraints
resultsarray of objectyes
results[].titlestringyes
results[].urlstringyes
  • format uri
results[].snippetstringyes
results[].enginestringyes
results[].publishedstring | nullyes
results[].licensestring | nullyes
results[].authorstring | nullyes
results[].source_pagestring | nullyes
results[].attributionstring | nullyes
results[].thumbnailstring | null
receiptobjectyes
  • no other fields
receipt.enginestringyes
receipt.cost_usdnumberyes
  • minimum 0
receipt.time_msnumberyes
  • minimum 0
receipt.attemptsarray of objectOrdered routing attempts with safe reason codes; no provider error bodies or credentials.
  • maxItems 64
  • items: no other fields
receipt.attempts[].providerstringyes
  • minLength 1
  • maxLength 100
receipt.attempts[].enginestringyes
  • minLength 1
  • maxLength 100
receipt.attempts[].modelstring | null
  • maxLength 200
receipt.attempts[].statusenumyes
  • one of "ok", "error", "skipped"
receipt.attempts[].reasonenum
  • one of "disabled", "unsupported", "no_credentials", "circuit_open", "daily_cap", "budget", "timeout", "upstream_error", "invalid_response"
receipt.attempts[].time_msnumberyes
  • minimum 0
receipt.attempts[].cost_usdnumberyes
  • minimum 0

Examples

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

Valid: fallback
{
  "results": [],
  "receipt": {
    "engine": "openverse",
    "cost_usd": 0,
    "time_ms": 5,
    "attempts": [
      {
        "provider": "brave",
        "engine": "brave",
        "status": "error",
        "reason": "timeout",
        "time_ms": 15000,
        "cost_usd": 0.005
      },
      {
        "provider": "openverse",
        "engine": "openverse",
        "status": "ok",
        "time_ms": 20,
        "cost_usd": 0
      }
    ]
  }
}
Valid: platform
{
  "results": [],
  "receipt": {
    "engine": "openverse",
    "cost_usd": 0,
    "time_ms": 5
  }
}
Rejected: platform
{}
Rejected: unsafe-reason
{
  "results": [],
  "receipt": {
    "engine": "openverse",
    "cost_usd": 0,
    "time_ms": 5,
    "attempts": [
      {
        "provider": "brave",
        "engine": "brave",
        "status": "error",
        "reason": "raw upstream error",
        "time_ms": 15000,
        "cost_usd": 0.005
      },
      {
        "provider": "openverse",
        "engine": "openverse",
        "status": "ok",
        "time_ms": 20,
        "cost_usd": 0
      }
    ]
  }
}

Validate

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