Origin Docs
Integrations

Gateway API Requests and Response Structure

How ORGN Gateway structures API requests and responses — success envelopes, error handling, usage metadata, and TEE attestation receipts.

A request is what your client sends: HTTP method, endpoint, headers, and JSON payload.

A response is what comes back: model output on success, or a structured error you must handle deterministically.

ORGN Gateway is an OpenAI-compatible HTTP API. The model you select determines execution: TEE models (near_*, phala_*) run in hardware-isolated Trust Domains with attestation receipts; ZDR models (vercel_*) run under policy zero retention. The wire format is identical.

The request

A minimal chat request contains:

  • A model selector (underscore format, e.g. near_gpt_oss_120b)
  • A messages array with your input
{
  "model": "near_gpt_oss_120b",
  "messages": [
    {
      "role": "user",
      "content": "Why is the sky blue? (1-2 sentences)"
    }
  ]
}

Authenticated requests go to:

POST https://api.gateway.orgn.com/v1/chat/completions
Authorization: Bearer sk-ollm-YOUR_API_KEY

The response contract

HTTP statusMeaning
2xxSuccess — completion payload
4xx / 5xxFailure — error envelope; do not read model output

Success: chat.completion

Default render target: choices[0].message.content

{
  "id": "chatcmpl-893c78e06a795cea",
  "model": "near_gpt_oss_120b",
  "object": "chat.completion",
  "choices": [
    {
      "finish_reason": "stop",
      "message": {
        "content": "The sky appears blue because...",
        "role": "assistant"
      }
    }
  ],
  "usage": {
    "completion_tokens": 92,
    "prompt_tokens": 81,
    "total_tokens": 173
  }
}

Always validate choices exists before reading content. Record usage.* for cost and observability.

Error responses

401 Unauthorized

Invalid or missing API key — no model invocation occurs. Fix credentials before retrying.

405 Method Not Allowed

Wrong HTTP method (e.g. GET instead of POST). Use POST /v1/chat/completions.

Retry only transient failures (timeouts, 5xx) with exponential backoff. Do not retry 401 or validation errors.

Attestation data (TEE only)

Attestation receipts apply to TEE models only. They are not embedded in the /v1/chat/completions response body.

Inspect receipts per request in ORGN Scanner or the Gateway console explorer. Each TEE receipt may include:

  • Intel TDX Quote — CPU-side Trust Domain proof
  • NVIDIA GPU Evidence — per-GPU firmware integrity
  • Message Signature — binds model identity to request/response hashes

See Attestation data reference.

ZDR models return the same JSON shape (id, choices, usage) but produce no cryptographic execution proof.

Production checklist

Before rendering output:

  • HTTP status is 2xx
  • No top-level error object
  • choices[0].message.content is present
  • usage.total_tokens recorded

On this page