Feeef Cloud
AI API

AI API

OpenAI-compatible generation, provider routing, exact usage billing, and durable tasks.

Start with the quickstart, explore models, or open the AI playground.

Enable the AI API for your project and link its billing account. Create a key with ai:generate for paid requests and ai:read for model/task/result reads. AI must also be enabled by the platform operator; available models are listed at GET /v1/models.

import OpenAI from 'openai'
const ai = new OpenAI({
  apiKey: process.env.FEEEF_CLOUD_KEY,
  baseURL: 'https://apis.cloud.feeef.org/v1',
  maxRetries: 0,
})
const result = await ai.chat.completions.create({
  model: 'MODEL_ID_FROM_CATALOG',
  messages: [{ role: 'user', content: 'Hello' }],
  max_completion_tokens: 1024,
}, { headers: { 'Idempotency-Key': 'my-stable-request-key' } })

chat/completions and responses support SSE streaming. JSON and multipart requests are supported for configured image, audio, and video endpoints. Supported endpoints, modalities, reviewed price versions, and expiry dates are published per model. Provider-specific parameters pass through. Selecting a model pins its provider; clients cannot replace upstream URLs, credentials, plugins, or fallback routes.

Native Google payloads use tasks with google/generateContent, google/predict, or google/predictLongRunning. Reviewed generateContent requests can also use /v1/google/generateContent directly. For an OpenAI chat payload with a Google model, select a route advertising the OpenAI style. See API styles for supported translation and native endpoint limits.

Background tasks and webhooks

{
  "endpoint": "images/generations",
  "body": { "model": "MODEL_ID_FROM_CATALOG", "prompt": "A small blue bird", "n": 1 }
}

POST that object to /v1/ai/tasks with a stable Idempotency-Key; receive a 202 with a task ID. Poll /v1/ai/tasks/{id}. For signed callbacks, register your endpoint through Cloud's existing webhook registry and subscribe to ai.task.completed, ai.task.failed, and ai.task.reconciliation_required. Callbacks contain the task ID and billing summary; retrieve the result with your API key. Arbitrary per-request callback URLs are not accepted.

For OpenAI video jobs, POST /v1/videos returns the upstream video object; GET /v1/videos/{id} and /content remain scoped to the creating project and tenant. The worker polls videos even if the caller disconnects. There is no automatic retry of a paid provider submission.

Billing

AI usage is postpaid: no credit or monthly allowance is reserved before a provider call. Verified actual usage is charged to the project's linked billing account, and its balance may go negative. Customer monthly caps stop new requests once settled usage reaches the cap; in-flight requests may finish above it. AI has no free per-request allowance. Charges appear on the billing account and invoices.

Provider cost uses exact decimal arithmetic. Cached reads, cache writes, reasoning, image/audio tokens, seconds, and additional provider meters must be covered by the model's reviewed price card. Unpriced or missing usage requires reconciliation. OpenRouter routes use its usage.cost (the amount charged to our account).

The default is 10% markup: a $1 reviewed billing basis becomes $1.10. Most routes use supplier cost as the basis; reviewed routes with a separate customer tariff expose both amounts in the receipt. Operators can choose 10% gross margin instead: $1 / 0.90. The final charge is rounded up once to the account ledger's micro-USD precision. Task billing shows wholesale cost separately from the customer billing basis and retail charge, and records the margin and price version used.

A timeout, interrupted stream, missing usage, or uncertain provider outcome retains the pending charge and exposes reconciliation_required. Keep the request ID. Repeat only with the original idempotency key; a new key creates a new billable request.

Compatibility boundaries

This API covers the configured generation endpoints, model listing, video reads, and Feeef tasks. It does not yet implement the entire OpenAI platform (Files, Assistants, Batch, fine-tuning, WebSockets/realtime, or Responses retrieval/cancel). Google native responses retain Google's response format. No model or modality is advertised until its adapter, request constraints, and full price card are reviewed.

On this page