Search docs ⌘K
esc
Type to search across all documentation pages
AI

AI

Atomic AI primitives for inference, embeddings, reranking, moderation, realtime sessions, document preparation, and async operation tracking. Keep threads, prompts, application memory, and source-of-truth records in your own SQL schema, then use Decisioning Search when you need managed retrieval.

Design boundary: SaaSignal exposes inference and retrieval building blocks, not assistants, threads, vector-store abstractions, or prompt management. Compose those higher-level concepts yourself with SQL, Storage, Jobs, and Webhooks.
Canonical vs compatibility: Prefer /infra/ai/* for the native SaaSignal contract. Use /v1/* aliases when you need OpenAI-compatible wire shapes for existing client code.

Model Catalog

Discover normalized provider:model identifiers, capability flags, modality support, limits, and pricing metadata.

List AI Models

GET
/infra/ai/models
typescript
const { data } = await ss.infra.ai.models.list()
  1. Open Dashboard → AI and select your project
  2. Go to the Catalog workspace
  3. Browse the normalized model catalog, compare capabilities, and copy the exact `provider:model` identifier you want to use in code.

Get AI Model

GET
/infra/ai/models/:model_id
typescript
const model = await ss.infra.ai.models.get('workers-ai:llama-3.1-8b-instruct')
  1. Open Dashboard → AI and select your project
  2. Go to the Catalog workspace
  3. Find the model card that matches your use case, then inspect pricing, modalities, and supported features before wiring requests against it.

List Models (OpenAI-Compatible)

GET
/v1/models
typescript
const models = await fetch(`${baseUrl}/v1/models`, { headers: { Authorization: `Bearer ${token}` } }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose GET /v1/models from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
Use this alias when you need an ecosystem-standard discovery path; the underlying billing and model catalog remain the same as `/infra/ai/models`.

Get Model (OpenAI-Compatible)

GET
/v1/models/:model_id
typescript
const model = await fetch(`${baseUrl}/v1/models/workers-ai:llama-3.1-8b-instruct`, { headers: { Authorization: `Bearer ${token}` } }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose GET /v1/models/{model_id} from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
This compatibility alias is most useful when a third-party SDK expects the OpenAI model catalog shape.

Responses

Generate text or multimodal outputs with canonical SaaSignal response routes or OpenAI-compatible aliases.

Create Response

POST
/infra/ai/responses
typescript
const result = await ss.infra.ai.responses.create({ model: 'workers-ai:llama-3.1-8b-instruct', input: 'Write a release note for the new AI primitive.' })
  1. Open Dashboard → AI and select your project
  2. Go to the Studio workspace
  3. Use the Responses card to run a synchronous prompt or queue the request as an async operation when you want to test the native SaaSignal response surface.

Create Response (OpenAI-Compatible)

POST
/v1/responses
typescript
const result = await fetch(`${baseUrl}/v1/responses`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:llama-3.1-8b-instruct', input: 'Summarize the deployment impact.' }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/responses from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
Choose this alias when you are porting an existing OpenAI Responses client and want to keep the wire format stable.

Chat Completions Alias

POST
/v1/chat/completions
typescript
const result = await ss.infra.ai.responses.chatCompletions({ model: 'workers-ai:llama-3.1-8b-instruct', messages: [{ role: 'user', content: 'Explain why decisioning search indexes are not app databases.' }] })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/chat/completions from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
This route exists for chat-completions compatibility only. The canonical SaaSignal surface is still `/infra/ai/responses`.

Realtime Sessions

Bootstrap short-lived browser/mobile credentials for realtime model sessions without exposing provider secrets.

Create Realtime Session

POST
/infra/ai/realtime/sessions
typescript
const session = await ss.infra.ai.realtime.createSession({ model: 'workers-ai:llama-3.1-8b-instruct', ttl_seconds: 900, voice: 'alloy' })
  1. Open Dashboard → AI and select your project
  2. Go to the Studio workspace
  3. Use the Realtime session card to mint short-lived browser credentials without ever handing provider secrets to the client.

Create Realtime Session (OpenAI-Compatible)

POST
/v1/realtime/sessions
typescript
const session = await fetch(`${baseUrl}/v1/realtime/sessions`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:llama-3.1-8b-instruct', ttl_seconds: 900 }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/realtime/sessions from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
Use the compatibility alias when your client runtime already expects the OpenAI realtime session bootstrap contract.

Representations, Ranking & Safety

Generate embeddings, rerank candidates, and run neutral moderation classifiers.

Create Embeddings

POST
/infra/ai/embeddings
typescript
const embeddings = await ss.infra.ai.embeddings.create({ model: 'workers-ai:bge-m3', input: 'Managed retrieval primitives for docs search' })
  1. Open Dashboard → AI and select your project
  2. Go to the Studio workspace
  3. Generate vectors from the Embeddings card, then feed those vectors into the Retrieval tab yourself because SaaSignal keeps embedding and index writes intentionally separate.

Create Embeddings (OpenAI-Compatible)

POST
/v1/embeddings
typescript
const embeddings = await fetch(`${baseUrl}/v1/embeddings`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:bge-m3', input: 'Managed retrieval primitives for docs search' }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/embeddings from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
This alias preserves the OpenAI embeddings wire shape while routing to the same SaaSignal embedding primitive and token ledger.

Rerank Documents

POST
/infra/ai/rerank
typescript
const reranked = await ss.infra.ai.rerank.create({ model: 'workers-ai:bge-reranker-base', query: 'Which guide explains async AI operations?', documents: ['Use /infra/ai/operations/:operation_id to inspect state.', 'Indexes auto-embed text on upsert.'] })
  1. Open Dashboard → AI and select your project
  2. Go to the Studio workspace
  3. Open the Rerank card, provide a query plus newline-separated candidate documents, and inspect the returned order and scores.

Run Moderation

POST
/infra/ai/moderations
typescript
const result = await ss.infra.ai.moderations.create({ model: 'workers-ai:llama-guard-3-8b', input: 'Review this user message for policy flags.' })
  1. Open Dashboard → AI and select your project
  2. Go to the Studio workspace
  3. Use the Moderation card to run a neutral classifier before you decide how your application policy should respond.

Run Moderation (OpenAI-Compatible)

POST
/v1/moderations
typescript
const result = await fetch(`${baseUrl}/v1/moderations`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:llama-guard-3-8b', input: 'Review this user message for policy flags.' }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/moderations from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
Reach for the compatibility alias when you are swapping an OpenAI moderation client over to SaaSignal with minimal application changes.

Audio

Transcribe, translate, and synthesize audio using SaaSignal-managed billing and async operation tracking.

Transcribe Audio

POST
/infra/ai/audio/transcriptions
typescript
const result = await ss.infra.ai.audio.transcribe({ model: 'workers-ai:whisper-large-v3-turbo', storage_ref: { bucket_id: 'sb_audio', key: 'calls/demo.wav' } })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /infra/ai/audio/transcriptions from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
Upload audio to Storage first, then pass a `storage_ref` from the API Console or SDK because the dashboard intentionally avoids opinionated media ingestion flows.

Transcribe Audio (OpenAI-Compatible)

POST
/v1/audio/transcriptions
typescript
const result = await fetch(`${baseUrl}/v1/audio/transcriptions`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:whisper-large-v3-turbo', storage_ref: { bucket_id: 'sb_audio', key: 'calls/demo.wav' } }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/audio/transcriptions from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Translate Audio

POST
/infra/ai/audio/translations
typescript
const result = await ss.infra.ai.audio.translate({ model: 'workers-ai:whisper-large-v3-turbo', storage_ref: { bucket_id: 'sb_audio', key: 'calls/es-demo.wav' } })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /infra/ai/audio/translations from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Translate Audio (OpenAI-Compatible)

POST
/v1/audio/translations
typescript
const result = await fetch(`${baseUrl}/v1/audio/translations`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:whisper-large-v3-turbo', storage_ref: { bucket_id: 'sb_audio', key: 'calls/es-demo.wav' } }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/audio/translations from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Generate Speech

POST
/infra/ai/audio/speech
typescript
const speech = await ss.infra.ai.audio.speech({ model: 'workers-ai:melotts', input: 'Welcome to your AI control plane.', voice: 'alloy' })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /infra/ai/audio/speech from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Generate Speech (OpenAI-Compatible)

POST
/v1/audio/speech
typescript
const speech = await fetch(`${baseUrl}/v1/audio/speech`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:melotts', input: 'Welcome to your AI control plane.', voice: 'alloy' }) }).then((res) => res.arrayBuffer())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/audio/speech from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Images

Generate, edit, and vary images. Large or async outputs can be written directly into SaaSignal Storage.

Generate Images

POST
/infra/ai/images/generations
typescript
const images = await ss.infra.ai.images.generate({ model: 'workers-ai:flux-1-schnell', prompt: 'Create a bold hero image for a serverless AI control plane.' })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /infra/ai/images/generations from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Generate Images (OpenAI-Compatible)

POST
/v1/images/generations
typescript
const images = await fetch(`${baseUrl}/v1/images/generations`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:flux-1-schnell', prompt: 'Create a bold hero image for a serverless AI control plane.' }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/images/generations from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Edit Images

POST
/infra/ai/images/edits
typescript
const result = await ss.infra.ai.images.edit({ model: 'workers-ai:flux-1-schnell', prompt: 'Add a futuristic control panel overlay.', image: { storage_ref: { bucket_id: 'sb_media', key: 'hero/original.png' } } })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /infra/ai/images/edits from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Edit Images (OpenAI-Compatible)

POST
/v1/images/edits
typescript
const result = await fetch(`${baseUrl}/v1/images/edits`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:flux-1-schnell', prompt: 'Add a futuristic control panel overlay.', image: { storage_ref: { bucket_id: 'sb_media', key: 'hero/original.png' } } }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/images/edits from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Create Image Variations

POST
/infra/ai/images/variations
typescript
const result = await ss.infra.ai.images.variations({ model: 'workers-ai:flux-1-schnell', prompt: 'Generate alternate campaign directions.', image: { storage_ref: { bucket_id: 'sb_media', key: 'hero/original.png' } } })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /infra/ai/images/variations from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Create Image Variations (OpenAI-Compatible)

POST
/v1/images/variations
typescript
const result = await fetch(`${baseUrl}/v1/images/variations`, { method: 'POST', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'workers-ai:flux-1-schnell', prompt: 'Generate alternate campaign directions.', image: { storage_ref: { bucket_id: 'sb_media', key: 'hero/original.png' } } }) }).then((res) => res.json())
  1. Open Dashboard → API Console and select your project
  2. Choose POST /v1/images/variations from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console

Documents

Parse supported files into normalized blocks, then chunk text deterministically before embedding or search writes.

Parse Documents

POST
/infra/ai/documents/parse
typescript
const parsed = await ss.infra.ai.documents.parse({ storage_ref: { bucket_id: 'sb_docs', key: 'manuals/architecture.pdf' }, async: true })
  1. Open Dashboard → API Console and select your project
  2. Choose POST /infra/ai/documents/parse from the route list
  3. Fill in the JSON body or Storage references, then send the request and inspect the response directly in the console
Use Storage references for PDFs, images, and office documents. The dashboard exposes chunking directly, while parse stays console-first because it is file-heavy by design.

Chunk Documents

POST
/infra/ai/documents/chunk
typescript
const chunks = await ss.infra.ai.documents.chunk({ text: 'Atomic AI primitives keep SQL as the source of truth.', max_chars: 240, overlap_chars: 40 })
  1. Open Dashboard → AI and select your project
  2. Go to the Studio workspace
  3. Use the Document chunking card to split text deterministically before embedding or index writes.

Async Operations

Track queued AI work, inspect result destinations, and cancel supported long-running tasks.

Get AI Operation

GET
/infra/ai/operations/:operation_id
typescript
const operation = await ss.infra.ai.operations.get('aiop_123')
  1. Open Dashboard → AI and select your project
  2. Go to the Operations workspace
  3. Paste an operation ID into the inspector to review state transitions, usage, result destinations, and any failure payload.

Cancel AI Operation

POST
/infra/ai/operations/:operation_id/cancel
typescript
const operation = await ss.infra.ai.operations.cancel('aiop_123')
  1. Open Dashboard → AI and select your project
  2. Go to the Operations workspace
  3. Inspect the queued or processing operation first, then use the cancel action when the generating task should stop before finalization.