Open Ai
API documentation

A clean API surface for model access, metering, and billing.

Use scoped keys, predictable endpoints, and clear response metadata to integrate Open Ai into your own applications.

Quick request
const response = await fetch("https://api.open-ai.dev/v1/responses", {
  method: "POST",
  headers: {
    Authorization: "Bearer nx_live_your_key",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "orion-reason",
    input: "Draft a migration checklist for a fintech API."
  })
});

const result = await response.json();

Authentication

All requests use bearer API keys. Keys can be scoped to projects, models, endpoints, IP ranges, and monthly budgets.

Responses API

Use /v1/responses for text, tools, JSON output, and multimodal inputs with unified usage metering.

Embeddings

Use /v1/embeddings for low-latency vector generation, cache-aware billing, and batched inputs.

Webhooks

Subscribe to invoice, wallet, rate-limit, key, and long-running request events with signed delivery.

Reference

Endpoint map

POST
/v1/responses

Generate model output with text, JSON, tools, or multimodal input.

POST
/v1/embeddings

Create embeddings for search, retrieval, and clustering.

GET
/v1/models

List available models, price cards, latency bands, and capabilities.

GET
/v1/usage

Query token, spend, latency, and request metrics by project or model.

POST
/v1/webhooks/endpoints

Register signed webhook endpoints for billing and API events.

Backend architecture

Production systems, mapped into a modular Next.js codebase.

Next.js App Router

Route groups for marketing, auth, dashboard, admin, and API handlers.

Prisma and Postgres

Ledger-backed credits, usage events, scoped keys, invoices, support tickets.

Stripe billing

Checkout sessions, wallet top-ups, invoices, and subscription plan metadata.

Redis edge cache

Rate limits, idempotency keys, model metadata cache, and API replay protection.

Auth boundary

Session flow is wired locally and structured for Clerk or Auth.js production identity.

Typed API layer

Zod-ready route handlers for marketplace, billing, admin, docs, and /v1 calls.

Response metadata

request_id
model
input_tokens
output_tokens
wallet_debit
cache_status

Webhook events

wallet.recharged
invoice.paid
key.revoked
usage.threshold_reached
request.completed
request.rate_limited