Zum Hauptinhalt springen
DokumentationInferenz-API · api.eu.ccsio.ai

Decisions

Decisions answered by the Clef decision model.

Menü der Dokumentation

Die Beschreibungen der Operationen und Felder stammen aus dem Vertrag und sind auf Englisch.

POST/v1/systemone

Create decisions

Anmeldedaten
API-Key
Berechtigung
inference.invoke
Request-Body
Body bis 8 MiB

Decisions through a decisions deployment: Cloudflare's Clef decision model (its SystemOne API), in the model's own wire rather than OpenAI's.

Weiterlesen

The body carries a state and one or more named questions, each of type noul (the probability that a proposition is true), choice (one option among several) or score (a position on a scale); the answer carries one answer object per question id and a usage block. The JSON body is relayed to the model server with only model rewritten, and the server's JSON answer is relayed; the operation never streams. The usage fact is operation decision with the input_tokens quantity (the answer's usage.input_tokens); an attempt that fails or does not finish carries no quantity, with measurement unknown and reason final_usage_missing. The platform refuses with 400 invalid-request a body without a model, without a state (null is a state), with questions that are not a non-empty object; the model server refuses with 400 a question it cannot read and the optional images or videos, which it does not serve. Of the model server's refusals three reach the caller: a 400 as 400 provider-bad-request and a 413 (input_too_long) as 413 provider-input-too-long, both with its own message (bounded and scrubbed), and a 429 (busy) as 429 provider-rate-limited. Its 404, its 503 (loading), any other status and an answer that is not a JSON object are a 502 provider-error; a timeout is a 504 provider-timeout.

curl
curl -X POST "https://api.eu.ccsio.ai/v1/systemone" \
  -H "Authorization: Bearer $CCSIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "clef",
  "state": {
    "ticket": 4312,
    "message": "Production has been down for two hours. This is the third outage this month and we will cancel the contract unless someone calls today."
  },
  "questions": {
    "urgent": {
      "type": "noul",
      "instructions": "Does this ticket need an answer within the hour?"
    },
    "team": {
      "type": "choice",
      "instructions": "Which team should take this ticket?",
      "criteria": {
        "billing": "Invoices, payments and refunds.",
        "technical": "Outages, errors and how the product works.",
        "sales": "Plans, upgrades and contracts."
      }
    },
    "frustration": {
      "type": "score",
      "instructions": "How frustrated is the customer?",
      "criteria": [
        "Calm.",
        "Annoyed.",
        "Angry.",
        "About to leave."
      ]
    }
  }
}'

Parameter

NameInBeschreibung
X-Session-Id
optional
headerstring

Optional client-provided session label, accepted on every /v1 operation. It groups the caller's requests in the request log (the session_id of the usage facts and of the request-log reads); it is a label only, never an identity, and is never used for authorization or tenancy.

Weiterlesen

Grammar ^[A-Za-z0-9._:-]{1,128}$, given at most once: anything else (empty, longer than 128 characters, other characters, repeated) is refused 400 session-id-invalid in the OpenAI error shape, after the credential, billing, permission and body-size checks and before the request is decoded.

X-Team-Id
optional
headerstring

The team the call acts for. Send it when the caller holds roles in more than one team: the platform cannot pick one, and without it the call is refused with 403 policy-denied.

Weiterlesen

Send it also to act for one team on purpose: the models that are listed and may be called then follow that team's entitlements, and the quota and the usage are attributed to it. The team must be one the caller is an active member of: a team the caller does not belong to, an archived team and a malformed identifier are refused with 403 team-not-selectable. A caller whose roles are organization-wide needs no team.

X-Organization-Id
optional
headerstring

The organization a signed-in person acts in, for a person who belongs to more than one.

Weiterlesen

A person with exactly one organization needs no header; a person with several is refused with 403 organization-selection-required without it, and a value that names an organization the person holds no active membership in is refused with 403 organization-not-selectable. An API key carries its own organization and ignores the header, except a platform administrator's credential and a platform operator signed in at the backoffice, who may name any existing organization (an operator who names none holds the platform context, which these operations refuse with 403 organization-selection-required). The header selects among memberships that already exist: it never grants one, and the residency of the organization it selects must be the plane's own (403 residency-mismatch).

Request-Body application/json

DecisionRequest
  • modelstringPflicht

    The broad C0 model_ref vocabulary. Gateway routing additionally requires the stricter C7 identifier pattern ^[a-z][a-z0-9._-]{0,63}$; a C0-valid value that is not C7-routeable is refused with 400.

    pattern ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$

  • stateanyPflicht

    What the questions are about: a text or an object. Any JSON value is accepted.

  • questionsobjectPflicht

    The questions to answer, keyed by a question id the caller chooses; the answer carries one entry under the same id.

Antworten

  • 200

    One answer per question of the request, and the input tokens the model read.

    Schema
    DecisionResponse
    • modelstringPflicht
    • answersobjectPflicht

      One answer per question id of the request.

    • usageobjectPflicht
      • input_tokensintegerPflicht

        at least 0

      • output_tokensintegerPflicht

        0 today; it is not metered.

        at least 0

  • 400

    The request is refused before it is dispatched, or the model server refused it. invalid-request: a body that is not valid JSON (or not multipart/form-data with a boundary), a member of the wrong type, a missing or empty model, a chat request with no messages, an embeddings or speech request with no input (speech: not a string), an images request with no prompt (not a string), a decisions request with no state, with questions that are not a non-empty object, a message content that is not a string, null or an array, a transcription whose multipart body does not carry exactly one plain model field. session-id-invalid: a malformed or repeated X-Session-Id. provider-bad-request: images and decisions only, the model server refused the request with 400 and the message is its own, bounded and scrubbed of any credential.

    Weiterlesen

    The refusals of the hop (a fault of the platform) are listed in x-ccsio-hop-error-codes.

    Fehlercodes:decision-capability-mismatchdecision-stream-mismatchinvalid-requestprovider-bad-requestsession-id-invalid
  • 401

    No credential, more than one, or one the platform does not accept: invalid-request (no credential, or both Authorization:

    Weiterlesen

    Bearer and x-api-key), api-key-invalid, api-key-unknown, api-key-revoked, api-key-expired, the refusals of a bearer token (token-malformed, token-algorithm-unsupported, token-signature-invalid, token-issuer-mismatch, token-audience-mismatch, token-expired, token-not-yet-valid, token-claim-invalid), the trust in its issuer (issuer-untrusted, issuer-resolution-unknown, issuer-residency-mismatch, jwks-unavailable, jwks-invalid, jwks-key-not-found), a person with no account on this plane (identity-not-provisioned, organization-not-found) and, for a backoffice operator's token, staff-token-inactive, staff-not-operator and staff-directory-unavailable. The complete list is x-ccsio-boundary-error-codes. A 401 can also be a refusal of the hop between core and the router (missing-verified-context, invalid-verified-context, context-signature-*): that is a fault of the platform, not of the credential. Supply exactly one credential.

  • 402

    payment-required: the organization has no active subscription.

    Weiterlesen

    The call is refused before its body is read; platform operators are exempt. credits-exhausted: the model is served from a third-party provider, the plane charges such models against prepaid credits, and the organization's balance is zero or negative; the organization tops up (or an operator credits it) and the next request is admitted. Streams already running finish. The model stays listed by GET /v1/models, which never answers credits-exhausted (and answers payment-required like every operation). The error type is invalid_request_error.

    Fehlercodes:credits-exhausted
  • 403

    Refused by the platform after the credential was accepted: policy-denied (no role of the caller holds the permission, a personal API key whose owner lacks it, an acting team that is ambiguous or no longer authorized), tenant-mismatch (X-Tenant names another organization), team-not-selectable (X-Team-Id names a team the caller cannot act for), organization-inactive and the other states of the organization (organization-provisioning, organization-suspended, organization-disabled, organization-deleted), user-disabled, organization-selection-required (a person who belongs to several organizations and sent no X-Organization-Id, or a platform operator who selected none), organization-not-selectable, no-active-organization-membership, entitlement-denied (the organization or the acting team is not entitled to the model, which includes a model that does not exist), residency-mismatch (the organization, or the deployment's residency, does not match the plane's) or external-model-not-available (the model is served from a third-party provider and the organization is not admitted to such models: while a payment provider is configured and credits are not enabled only an organization that is billing-exempt or billed by contract is admitted; on a plane where credits are enabled the gate is credits-exhausted or model-not-priced instead, and this refusal is not answered; the model stays listed by GET /v1/models).

    Fehlercodes:entitlement-deniedexternal-model-not-availableorganization-inactiveresidency-mismatch
  • 404

    model-not-found: the organization is entitled to the model but no active deployment serves it with the operation's capability. A chat or embeddings model on an audio route, and an audio model on any other route, is refused this way. A path under /v1/ that nothing claims is also a 404, with the code not-found.

    Fehlercodes:model-not-found
  • 405

    method-not-allowed: the path is claimed but the request method is not allowed. The Allow header lists the methods the path accepts.

  • 413

    request-body-too-large: the request body exceeds the operation's cap (8388608 bytes for a JSON body, 26214400 for an audio transcription upload); answered after authentication and authorization (an unauthenticated or unauthorized request is refused first, without its body being read).

    Fehlercodes:provider-input-too-long
  • 429

    A concurrency or rate limit of the organization, the team, the model or the deployment was reached (organization-concurrency-exceeded, team-concurrency-exceeded, model-concurrency-exceeded, deployment-concurrency-exceeded, rate-limit-exceeded; entitlement-denied, which the router answers as a defense in depth when the model is outside the entitlements the hop carries and core has already checked), or the model server rate-limited the call (provider-rate-limited: audio, images, decisions, and chat with a stream; chat without a stream answers that case 503 provider-unavailable).

    Weiterlesen

    The router knows when a retry may succeed, but the API host does not relay a Retry-After header: retry with backoff.

    Fehlercodes:deployment-concurrency-exceededentitlement-deniedmodel-concurrency-exceededorganization-concurrency-exceededprovider-rate-limitedrate-limit-exceededteam-concurrency-exceeded
  • 500

    A failure of the platform, rendered without internal cause details: internal-error (core could not decide or load what the request needs), quota-store-unavailable (the router could not read its quota store, so the request was refused) and, for a fault of the hop, unsupported-protocol-version, deployment-not-active, tenant-mismatch, model-pin-mismatch, placement-mismatch, bundle-tenant-mismatch and upstream-endpoint-invalid.

    Fehlercodes:internal-errorquota-store-unavailable
  • 502

    The model server failed or its answer could not be used: provider-error (it answered an error status other than a 429 that this operation passes on, or nothing usable; its own error body is never relayed), provider-credential-rejected (it answered 401 or 403 to the API key stored for the model's deployment), forwarder-failed (core could not reach the router), internal-hop-body (the router could not read the body core sent). The stored key never appears in any answer.

    Fehlercodes:forwarder-failedprovider-credential-rejectedprovider-error
  • 503

    provider-unavailable (OpenAI shape): no deployment of the model is currently healthy, or the one deployment there is failed this very request with a 429, a 5xx or an answer that was not one (on chat without a stream, and on embeddings and non-streaming Responses, where it is rendered in the kernel envelope). model-not-priced (OpenAI shape, type server_error): the model is served from a third-party provider, the plane charges such models against prepaid credits and no price is set for the model in the plane's currency; nothing is dispatched. router-not-configured (the platform kernel envelope, the one deliberate exception of core): this deployment has no inference router at all.

    Fehlercodes:model-not-pricedprovider-unavailablerouter-not-configured
  • 504

    provider-timeout: the dispatch deadline passed before the model server answered. Audio, images, decisions and chat; embeddings and Responses never answer 504.

    Fehlercodes:provider-timeout
  • 508

    loop-detected: the request carried the X-Ccsio-Egress header, which the platform's own egress adds to every request it makes to a model provider. It is answered when a provider connection points back at the platform's own API; an ordinary client never meets it.

    Fehlercodes:loop-detected
Beispielantwort
{
  "model": "clef",
  "answers": {
    "urgent": {
      "type": "noul",
      "noul": 0.9542
    },
    "team": {
      "type": "choice",
      "choice": "technical",
      "confidence": 0.927,
      "probabilities": {
        "billing": 0.0175,
        "technical": 0.927,
        "sales": 0.0556
      }
    },
    "frustration": {
      "type": "score",
      "score": 2.8823,
      "confidence": 0.8997,
      "legend": {
        "0": "Calm.",
        "1": "Annoyed.",
        "2": "Angry.",
        "3": "About to leave."
      },
      "probabilities": {
        "0": 0.0035,
        "1": 0.0104,
        "2": 0.0863,
        "3": 0.8997
      }
    }
  },
  "usage": {
    "input_tokens": 382,
    "output_tokens": 0
  }
}

Erzeugt aus den Plattformverträgen beim Commit 5f833620.

Plattform entdecken

Deinen ersten API-Key holen

Die Registrierung ist offen. Vier Schritte bis zum ersten Aufruf: Konto erstellen, Organisation anlegen, API-Key erzeugen, loslegen.

  1. 01Konto erstellen
  2. 02Organisation anlegen
  3. 03API-Key erzeugen
  4. 04Loslegen