VocalDocscontracts 1.65.0

Add one key's vendor price, now or from a later instant

POST /v1/platform/vendor-prices

PropertyValue
Operationadd_vendor_price
GroupPlatform
Scopeplatform:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited platform.price.add (mutation)
Released in1.38.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Writes one row per unit of the entry in one transaction (1.38.0), with origin operator, the caller as entered_by, and the Audit event platform.price.add, which records the ids, the Provider, the stage, the model, the units, effective_from and the ids it replaced. An entry whose effective_from is later than now is upcoming and takes effect at that instant with no deploy; an entry with the key and effective_from of an upcoming row replaces it, and one with those of a row in force or ended is refused. Refused with validation_failed: a price not above 0 (price_not_positive), an effective_from before the transaction's instant (price_effective_in_past), a price above price_ceiling_factor times the highest price in force of its unit (price_above_ceiling), a replacement of a row in force or ended (price_not_replaceable), and a Provider and chain stage the catalog does not serve (provider_not_allowed, reason stage_not_served). A refused entry writes no row.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the platform:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/platform/vendor-prices" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "mock",
    "stage": "stt",
    "model": "<model>",
    "units": [
      {
        "unit": "audio_minute",
        "unit_price_micros": 1
      }
    ],
    "source": {
      "url": "https://example.test/a",
      "read_at": "<read_at>"
    },
    "source_figure": "<source_figure>",
    "verified": false
  }'

Parameters

NameInTypeRequiredDescription
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: VendorPriceAddRequest.

FieldTypeRequiredDescription
effective_fromRequestTimestampnoThe instant, in UTC, from which the entry is in force; the transaction's instant when absent. A later instant enters an upcoming price, which takes effect then with no deploy; an earlier one is refused with price_effective_in_past.
modelstring or nullyesThe model priced, required on stt, llm and tts: a recognizer model, a language model, or the model a voice is spoken with. Null only on telephony, for a carrier minute, and on platform.
notestringnoA conversion or a remark; never a secret or content.
planstringnoThe vendor's plan or tier; none when absent.
providerCostProvideryes
regionstringnoThe region the price applies to, as the vendor names it; none when absent.
sourceVendorPriceSourceInputyes
source_figurestringyesThe figure as the source states it, such as a price per million tokens.
stageCostStageyes
unitsarray of VendorPriceUnitInputyesOne or two units of the stage, each once: audio_minute on stt, token_in and token_out on llm, character on tts, minute on telephony, minute or call on platform.
verifiedbooleanyesTrue only when the price was read from source on its read_at.

Responses

StatusContent typeShapeError codes
201application/jsonVendorPriceAddResult
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is VendorPriceAddResult.

FieldTypeRequiredDescription
object"vendor_price_add"yes
pricesarray of VendorPriceyesThe rows written, one per unit of the request, in its order.
replacedarray of VendorPriceIdyesThe upcoming rows the entry replaced, by id; empty when it replaced none.