AI
Image generations, prompt templates, voiceover, template & page AI actions, and the chat agent API.
The AI surface has four areas: image generations (async records you poll), one-shot AI
actions (synchronous request/response under /actions), the chat agent (conversations
with tools, MCP servers, rules and skills), and prompt templates that power the image
studio. Everything is charged from the user's wallet in credits (1 credit = 1 DZD) — see
Billing & credits.
Template-focused AI (custom components, page edits, landing-page generation) is covered conceptually in Templates → AI; this page documents the HTTP surface. General request/response conventions live in API conventions.
Image generations
Async jobs: POST …/generate returns the record immediately with status: "pending" and the
image is produced in the background. Poll GET /v1/image_generations/{id} until status is
completed, published or failed (failure reason under configs.error).
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /v1/image_generations/gallery | Public feed of published generations | Public |
| GET | /v1/image_generations | List yours, or a store's via store_id; filter by tags | Bearer |
| GET | /v1/image_generations/{id} | One record (config, error, image URL) | Bearer |
| POST | /v1/image_generations/generate | Create (or reuse via id) and dispatch a run | Bearer |
| POST | /v1/image_generations/{id}/generate | Re-run on the same record | Bearer |
| PATCH | /v1/image_generations/{id} | Rename; toggle status between published and completed | Bearer |
| DELETE | /v1/image_generations/{id} | Soft-delete | Bearer |
| POST | /v1/image_generations | Legacy create — behaves exactly like /generate | Bearer |
generate accepts multipart form data: prompt, storeId, model (catalog id), aspectRatio,
imageSize (1K / 2K / 4K), resolution (how reference images are processed), attachments
(JSON array of image / store / product / audio refs — store and product ids are expanded
into structured brand/product context server-side), an optional imageFile to edit, and
per-model options (googleSearch, imageSearch, background, quality, outputFormat).
At least one of prompt, image or reference attachments is required. A record that is still
pending/processing answers 409 — create a new one instead.
curl -X POST "https://api.feeef.org/v1/image_generations/generate" \
-H "Authorization: Bearer $FEEEF_TOKEN" \
-F "storeId=YOUR_STORE_ID" \
-F "prompt=Product hero shot on a marble table, warm light" \
-F "aspectRatio=1:1" \
-F "imageSize=2K"
# then poll:
curl -H "Authorization: Bearer $FEEEF_TOKEN" \
"https://api.feeef.org/v1/image_generations/{id}"Image prompt templates
Reusable, admin-curated prompts (with attachments, propsSchema and props) that the image
studio renders as one-tap presets. Reads are public and served from a server-side cache;
writes are restricted to platform admins.
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /v1/image_prompt_templates | List — filters q, tags, hasPreview, orderBy | Public |
| GET | /v1/image_prompt_templates/{id} | One template | Public |
| POST | /v1/image_prompt_templates | Create (platform admin) | Bearer |
| PUT | /v1/image_prompt_templates/{id} | Update (platform admin) | Bearer |
| DELETE | /v1/image_prompt_templates/{id} | Delete (platform admin) | Bearer |
SDKs: ff.imagePromptTemplates.list(...) / .find(...) in both JavaScript and Dart.
One-shot AI actions
Synchronous RPC-style endpoints under /v1/actions. All require a Bearer token; store-scoped
actions also check membership/permissions on the target store. Responses share the shape
{ "success": true | false, "message": "...", ... } with the payload alongside.
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /v1/actions/generateVoiceover | Text-to-speech (script enhancement, styles, multi-speaker) | Bearer |
| POST | /v1/actions/editOrGenerateSimpleImage | Synchronous image generate/edit — returns imageUrl | Bearer |
| POST | /v1/actions/generateLogo | LogoStudio — creates an image-generation record (PNG, alpha) | Bearer |
| POST | /v1/actions/generateSimpleCode | Small code snippets for the template editors | Bearer |
| POST | /v1/actions/updateProductUsingAi | Create/update a product from natural language | Bearer |
| POST | /v1/actions/updateShippingPriceUsingAi | Create/update shipping prices from natural language | Bearer |
| POST | /v1/actions/generateListFilterUsingAi | Natural language to a list filter / filterator | Bearer |
| POST | /v1/actions/generateDatePresetUsingAi | Natural language to a date-range preset | Bearer |
generateVoiceover takes text and/or attachments, optional voiceName (default Fenrir),
model, enhanceScript, styleInstructions, and speakers (exactly two for multi-speaker
dialogue). It returns audioUrl plus metadata with the enhanced script, token counts and the
actual userCostDZD — voiceover is settled from real usage after generation, not the estimate.
curl -X POST "https://api.feeef.org/v1/actions/generateVoiceover" \
-H "Authorization: Bearer $FEEEF_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"storeId": "YOUR_STORE_ID",
"text": "عرض خاص هذا الأسبوع — توصيل مجاني لكل الولايات!",
"voiceName": "Fenrir",
"enhanceScript": true
}'Template & landing-page AI
The endpoints behind the template editor's AI features — see
Templates → AI for how the generated structures plug into TemplateData.
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /v1/actions/generateCustomComponentCode | JSX component + propsSchema + props (+ slots) | Bearer |
| POST | /v1/actions/editTemplatePageUsingAi | Full-page structure create/edit for the template editor | Bearer |
| POST | /v1/actions/generateProductLandingPageTemplateData | Landing-page TemplateData from a prompt/attachments | Bearer |
| POST | /v1/actions/generateImageLandingPage | Long image-based landing page (sectioned image) | Bearer |
| POST | /v1/actions/generateAiLandingPage | Async job: enhance prompt, generate, create the page | Bearer |
| GET | /v1/actions/getAiLandingPageJobStatus | Poll job status by jobId | Bearer |
generateAiLandingPage runs a two-step flow (prompt enhancement, then one-shot generation of
designSpec + defaults) in the background and creates the landing page plus a notification when
done. It needs storeId, productId and a prompt and/or attachments; poll the job status
roughly every 10 seconds until it reports completed with a landingPageId.
curl -X POST "https://api.feeef.org/v1/actions/generateAiLandingPage" \
-H "Authorization: Bearer $FEEEF_TOKEN" \
-H "Content-Type: application/json" \
-d '{"storeId": "STORE_ID", "productId": "PRODUCT_ID", "prompt": "Classic luxury theme"}'
curl -H "Authorization: Bearer $FEEEF_TOKEN" \
"https://api.feeef.org/v1/actions/getAiLandingPageJobStatus?jobId=JOB_ID"Chat (agent API)
User-scoped conversations with an agent that can call tools, use MCP servers, and follow
user-defined rules and skills. All routes below sit under /v1/chat and require a Bearer token
(one exception noted).
Conversations, messages & generations
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /v1/chat/models | Chat-capable models from the catalog | Bearer |
| GET | /v1/chat/conversations | List — page, limit, q, archived | Bearer |
| POST | /v1/chat/conversations | Create — modelId, optional resources, mcpServerIds, toolPolicy | Bearer |
| GET | /v1/chat/conversations/{id} | Detail + messages (limit, before); includes any active generation | Bearer |
| PATCH | /v1/chat/conversations/{id} | Update title/model/resources/MCP servers/archive/tool policy | Bearer |
| DELETE | /v1/chat/conversations/{id} | Delete conversation | Bearer |
| POST | /v1/chat/conversations/{id}/messages | Send parts (starts a generation) or a userEvent | Bearer |
| DELETE | /v1/chat/conversations/{id}/messages/{messageId} | Delete a message | Bearer |
| GET | /v1/chat/generations/{generationId} | Snapshot + event log (sinceSeq for increments) | Bearer |
| POST | /v1/chat/generations/{generationId}/cancel | Request cancel at the next checkpoint | Bearer |
| GET | /v1/chat/jobs/{jobId} | Background job spawned by a generation | Bearer |
| GET | /v1/chat/conversations/{id}/queue | List queued prompts | Bearer |
| POST | /v1/chat/conversations/{id}/queue | Enqueue a prompt (parts) | Bearer |
| PUT | /v1/chat/conversations/{id}/queue/reorder | Reorder by orderedIds | Bearer |
| POST | /v1/chat/conversations/{id}/queue/consume | Pop and send the next (or a specific) queued prompt | Bearer |
| PATCH | /v1/chat/conversations/{id}/queue/{itemId} | Edit a queued prompt | Bearer |
| DELETE | /v1/chat/conversations/{id}/queue/{itemId} | Remove a queued prompt | Bearer |
| POST | /v1/chat/estimate | Cost estimate for capability: image, voiceover, landing_page, product_ai, text | Bearer |
Sending parts answers 202 with userMessageId, assistantMessageId, generationId and a
transmitChannel (users/{userId}/chat/generations/{generationId}). Follow progress over
realtime SSE on that channel, or poll the generation with sinceSeq.
Tool approval is a userEvent on the same messages endpoint. When the agent proposes a tool
call that the conversation's toolPolicy doesn't auto-approve, reply with
confirm_action and the action id. Other event types: user_input (answers to agent
questions), choice_selected, cancel_action, task_toggled, block_action, regenerate,
continue, edit_resend, and client_tool_result.
# create a conversation, send a message, approve a tool call
curl -X POST "https://api.feeef.org/v1/chat/conversations" \
-H "Authorization: Bearer $FEEEF_TOKEN" -H "Content-Type: application/json" \
-d '{"modelId": "gemini-flash-latest"}'
curl -X POST "https://api.feeef.org/v1/chat/conversations/{id}/messages" \
-H "Authorization: Bearer $FEEEF_TOKEN" -H "Content-Type: application/json" \
-d '{"parts": [{"type": "text", "text": "How many pending orders do I have?"}]}'
curl -X POST "https://api.feeef.org/v1/chat/conversations/{id}/messages" \
-H "Authorization: Bearer $FEEEF_TOKEN" -H "Content-Type: application/json" \
-d '{"userEvent": {"type": "confirm_action", "actionId": "ACTION_ID", "approved": true}}'MCP servers, rules & skills
The agent can call tools on user-registered MCP servers (streamable HTTP, optional headers or
OAuth). Rules inject user-authored markdown into the system prompt; skills are shareable
SKILL.md packages with a marketplace.
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /v1/chat/mcp-servers | List registered servers (headers masked) | Bearer |
| POST | /v1/chat/mcp-servers | Register — name, url, transport, headers, toolAllowlist | Bearer |
| PATCH | /v1/chat/mcp-servers/{id} | Update / clearHeaders | Bearer |
| DELETE | /v1/chat/mcp-servers/{id} | Remove | Bearer |
| POST | /v1/chat/mcp-servers/{id}/test | Probe: reachability, auth state, tool count | Bearer |
| GET | /v1/chat/mcp-servers/{id}/tools | List the server's tools | Bearer |
| POST | /v1/chat/mcp-servers/{id}/oauth/start | Begin OAuth — returns authorizeUrl | Bearer |
| POST | /v1/chat/mcp-servers/{id}/oauth/complete | Exchange the code, store tokens | Bearer |
| GET | /v1/chat/mcp-servers/oauth/meta-callback | Meta Ads OAuth redirect target | Public |
| GET | /v1/chat/rules | List rules | Bearer |
| POST | /v1/chat/rules | Create — name, content, enabled | Bearer |
| PATCH | /v1/chat/rules/{id} | Update | Bearer |
| DELETE | /v1/chat/rules/{id} | Delete | Bearer |
| GET | /v1/chat/skills/marketplace | Published skills | Bearer |
| GET | /v1/chat/skills/mine | Your skills | Bearer |
| GET | /v1/chat/skills/template | Starter SKILL.md template | Bearer |
| GET | /v1/chat/skills | Merged catalog: built-ins + MCP + marketplace + yours | Bearer |
| POST | /v1/chat/skills | Create from skillMd | Bearer |
| GET | /v1/chat/skills/{id} | One skill | Bearer |
| PATCH | /v1/chat/skills/{id} | Update | Bearer |
| POST | /v1/chat/skills/{id}/publish | Publish to the marketplace | Bearer |
| POST | /v1/chat/skills/{id}/unpublish | Unpublish | Bearer |
| DELETE | /v1/chat/skills/{id} | Delete | Bearer |
The Dart SDK wraps all of this under ff.chat (conversations, messages, generations,
jobs, mcpServers, models, billing, queue, rules, skills). The JavaScript SDK does
not wrap the chat API yet — use axios against the paths above.
Billing & credits
- Provider costs (USD) are converted to credits with the platform exchange rate (default
260 DZD/USD) and a retail markup (default 2.5×). Reference attachments add a small per-file
surcharge that scales with
resolution. - Image generations pre-check the wallet before dispatching. Insufficient balance answers
402withcode: "INSUFFICIENT_BALANCE"anddetails(requiredAmount,currentBalance,breakdown); the estimate is computed exactly like the final charge. - Voiceover settles from actual token usage after generation and reports
userCostDZDin the response metadata. - Chat requires a positive balance to start a generation (
402otherwise). Mid-flight events — tool confirmations, answers to agent questions — always pass. - Text generations whose prompt stays under the free-tier threshold (default 1,000 prompt tokens) are free.
- Use
POST /v1/chat/estimateto show a price before running any capability. Charges appear asai_generationtransfers in the wallet history.