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
ai:read

List AI models exposed by SaaSignal. Model IDs are normalized as provider:model strings.

curl
curl https://api.saasignal.saastemly.com/infra/ai/models \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
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.
Error responses
401 Unauthorized
403 Forbidden
429 Rate limited

Get AI Model

GET
/infra/ai/models/{model_id}
ai:read

Get a single AI model definition.

curl
curl https://api.saasignal.saastemly.com/infra/ai/models/{model_id} \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
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.
Path param
Type
Description
model_id required
string
Error responses
401 Unauthorized
403 Forbidden
404 Not found
429 Rate limited

List Models (OpenAI-Compatible)

GET
/v1/models
ai:read

List AI models exposed by SaaSignal. Model IDs are normalized as provider:model strings.

curl
curl https://api.saasignal.saastemly.com/v1/models \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
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`.
Error responses
401 Unauthorized
403 Forbidden
429 Rate limited

Get Model (OpenAI-Compatible)

GET
/v1/models/{model_id}
ai:read

Get a single AI model definition.

curl
curl https://api.saasignal.saastemly.com/v1/models/{model_id} \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
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.
Path param
Type
Description
model_id required
string
Error responses
401 Unauthorized
403 Forbidden
404 Not found
429 Rate limited

Responses

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

Create Response

POST
/infra/ai/responses
ai:generate

Canonical AI response route. Accepts text and multimodal message content where the selected model supports it. Supports sync JSON, SSE streaming, and async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/responses \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
instructions
string
input
mixed
messages
array
stream
boolean
default false
async
boolean
default false
temperature
number
range ≥0 .. ≤2
max_output_tokens
integer
range ≥1 .. ≤8192
response_format
object
result_destination
object
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Create Response (OpenAI-Compatible)

POST
/v1/responses
ai:generate

Canonical AI response route. Accepts text and multimodal message content where the selected model supports it. Supports sync JSON, SSE streaming, and async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/responses \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
instructions
string
input
mixed
messages
array
stream
boolean
default false
async
boolean
default false
temperature
number
range ≥0 .. ≤2
max_output_tokens
integer
range ≥1 .. ≤8192
response_format
object
result_destination
object
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Chat Completions Alias

POST
/v1/chat/completions
ai:generate

OpenAI-compatible chat-completions alias that resolves through the same AI response service layer and billing path as /infra/ai/responses.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/chat/completions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"messages":[]}'
json — 200 OK
{ "status": "ok" }
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`.
Body field
Type
Description
model
string
messages required
array
stream
boolean
default false
async
boolean
default false
temperature
number
range ≥0 .. ≤2
max_tokens
integer
range ≥1 .. ≤8192
response_format
object
result_destination
object
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Realtime Sessions

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

Create Realtime Session

POST
/infra/ai/realtime/sessions
ai:generate0.0000010 tokens

Mint a short-lived SaaSignal-managed realtime session descriptor without exposing provider credentials. Returns a proxy URL when realtime support is configured.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/realtime/sessions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
ttl_seconds
integer
range ≥30 .. ≤3600
voice
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited
501 Realtime proxy not configured

Create Realtime Session (OpenAI-Compatible)

POST
/v1/realtime/sessions
ai:generate0.0000010 tokens

Mint a short-lived SaaSignal-managed realtime session descriptor without exposing provider credentials. Returns a proxy URL when realtime support is configured.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/realtime/sessions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
ttl_seconds
integer
range ≥30 .. ≤3600
voice
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited
501 Realtime proxy not configured

Representations, Ranking & Safety

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

Create Embeddings

POST
/infra/ai/embeddings
ai:generate

Generate embedding vectors. Embeddings are returned only; SaaSignal does not auto-index text in v1.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/embeddings \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
input required
mixed
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Create Embeddings (OpenAI-Compatible)

POST
/v1/embeddings
ai:generate

Generate embedding vectors. Embeddings are returned only; SaaSignal does not auto-index text in v1.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/embeddings \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
input required
mixed
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Rerank Documents

POST
/infra/ai/rerank
ai:generate

Reorder caller-supplied candidates. This route does not perform retrieval by itself.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/rerank \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"query":"...","documents":[]}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
query required
string
min 1 chars
documents required
array
1–100 items
top_n
integer
range ≥1 .. ≤100
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Run Moderation

POST
/infra/ai/moderations
ai:generate

Policy-neutral moderation and safety classification. No SaaSignal-hosted moderation profiles are persisted in v1.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/moderations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
input required
mixed
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Run Moderation (OpenAI-Compatible)

POST
/v1/moderations
ai:generate

Policy-neutral moderation and safety classification. No SaaSignal-hosted moderation profiles are persisted in v1.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/moderations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
input required
mixed
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Audio

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

Transcribe Audio

POST
/infra/ai/audio/transcriptions
ai:generate

Transcribe audio from multipart upload, storage reference, or base64 payloads. Supports async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/audio/transcriptions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
model
string
prompt
string
language
string
storage_ref
object
base64
string
content_type
string
name
string
async
boolean
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Transcribe Audio (OpenAI-Compatible)

POST
/v1/audio/transcriptions
ai:generate

Transcribe audio from multipart upload, storage reference, or base64 payloads. Supports async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/audio/transcriptions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt
string
language
string
storage_ref
object
base64
string
content_type
string
name
string
async
boolean
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Translate Audio

POST
/infra/ai/audio/translations
ai:generate

Translate audio from multipart upload, storage reference, or base64 payloads. Supports async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/audio/translations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt
string
language
string
storage_ref
object
base64
string
content_type
string
name
string
async
boolean
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Translate Audio (OpenAI-Compatible)

POST
/v1/audio/translations
ai:generate

Translate audio from multipart upload, storage reference, or base64 payloads. Supports async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/audio/translations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt
string
language
string
storage_ref
object
base64
string
content_type
string
name
string
async
boolean
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Generate Speech

POST
/infra/ai/audio/speech
ai:generate

Generate speech audio from text. Small payloads can return inline audio; larger or async outputs can be written to Storage.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/audio/speech \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"input":"..."}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
input required
string
min 1 chars
voice
string
response_format
string
values: json, binarydefault json
async
boolean
default false
result_destination
object
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Generate Speech (OpenAI-Compatible)

POST
/v1/audio/speech
ai:generate

Generate speech audio from text. Small payloads can return inline audio; larger or async outputs can be written to Storage.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/audio/speech \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"input":"..."}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
input required
string
min 1 chars
voice
string
response_format
string
values: json, binarydefault json
async
boolean
default false
result_destination
object
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Images

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

Generate Images

POST
/infra/ai/images/generations
ai:generate

Generate images from prompts. Canonical routes can also write assets to Storage destinations. Supports async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/images/generations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt":"..."}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt required
string
min 1 chars
n
integer
range ≥1 .. ≤4
size
string
pattern ^\d+x\d+$
steps
integer
range ≥1 .. ≤16
async
boolean
default false
result_destination
object
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Generate Images (OpenAI-Compatible)

POST
/v1/images/generations
ai:generate

Generate images from prompts. Canonical routes can also write assets to Storage destinations. Supports async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/images/generations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt":"..."}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt required
string
min 1 chars
n
integer
range ≥1 .. ≤4
size
string
pattern ^\d+x\d+$
steps
integer
range ≥1 .. ≤16
async
boolean
default false
result_destination
object
webhook_topic
string
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Edit Images

POST
/infra/ai/images/edits
ai:generate

Edit an existing image using a prompt plus the source asset. Supports base64 or Storage references and async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/images/edits \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt":"...","image":{}}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt required
string
min 1 chars
n
integer
range ≥1 .. ≤4
size
string
pattern ^\d+x\d+$
steps
integer
range ≥1 .. ≤16
async
boolean
default false
result_destination
object
webhook_topic
string
image required
object
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Edit Images (OpenAI-Compatible)

POST
/v1/images/edits
ai:generate

Edit an existing image using a prompt plus the source asset. Supports base64 or Storage references and async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/images/edits \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt":"...","image":{}}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt required
string
min 1 chars
n
integer
range ≥1 .. ≤4
size
string
pattern ^\d+x\d+$
steps
integer
range ≥1 .. ≤16
async
boolean
default false
result_destination
object
webhook_topic
string
image required
object
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Create Image Variations

POST
/infra/ai/images/variations
ai:generate

Vary an existing image using a prompt plus the source asset. Supports base64 or Storage references and async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/images/variations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt":"...","image":{}}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt required
string
min 1 chars
n
integer
range ≥1 .. ≤4
size
string
pattern ^\d+x\d+$
steps
integer
range ≥1 .. ≤16
async
boolean
default false
result_destination
object
webhook_topic
string
image required
object
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Create Image Variations (OpenAI-Compatible)

POST
/v1/images/variations
ai:generate

Vary an existing image using a prompt plus the source asset. Supports base64 or Storage references and async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/v1/images/variations \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt":"...","image":{}}'
json — 200 OK
{ "status": "ok" }
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
Body field
Type
Description
model
string
prompt required
string
min 1 chars
n
integer
range ≥1 .. ≤4
size
string
pattern ^\d+x\d+$
steps
integer
range ≥1 .. ≤16
async
boolean
default false
result_destination
object
webhook_topic
string
image required
object
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Documents

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

Parse Documents

POST
/infra/ai/documents/parse
ai:generate

Parse supported text and image documents into normalized layout-aware blocks. Supports multipart upload, Storage references, and async: true.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/documents/parse \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
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.
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Chunk Documents

POST
/infra/ai/documents/chunk
ai:generate0.0000015 tokens

Deterministically chunk raw text or parsed blocks into retrieval-ready slices.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/documents/chunk \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
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.
Body field
Type
Description
text
string
blocks
array
max_chars
integer
range ≥100 .. ≤8000
overlap_chars
integer
range ≥0 .. ≤4000
Error responses
400 Bad request
401 Unauthorized
402 Insufficient tokens
403 Forbidden
429 Rate limited

Async Operations

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

Get AI Operation

GET
/infra/ai/operations/{operation_id}
ai:read

Get the status and result metadata for an async AI operation.

curl
curl https://api.saasignal.saastemly.com/infra/ai/operations/{operation_id} \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
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.
Path param
Type
Description
operation_id required
string
Error responses
401 Unauthorized
403 Forbidden
404 Not found
429 Rate limited

Cancel AI Operation

POST
/infra/ai/operations/{operation_id}/cancel
ai:generate

Cancel an async AI operation that has not yet completed.

curl
curl -X POST https://api.saasignal.saastemly.com/infra/ai/operations/{operation_id}/cancel \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
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.
Path param
Type
Description
operation_id required
string
Error responses
401 Unauthorized
403 Forbidden
404 Not found
429 Rate limited