.dev
REST API

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).

MethodPathDescriptionAuth
GET/v1/image_generations/galleryPublic feed of published generationsPublic
GET/v1/image_generationsList yours, or a store's via store_id; filter by tagsBearer
GET/v1/image_generations/{id}One record (config, error, image URL)Bearer
POST/v1/image_generations/generateCreate (or reuse via id) and dispatch a runBearer
POST/v1/image_generations/{id}/generateRe-run on the same recordBearer
PATCH/v1/image_generations/{id}Rename; toggle status between published and completedBearer
DELETE/v1/image_generations/{id}Soft-deleteBearer
POST/v1/image_generationsLegacy create — behaves exactly like /generateBearer

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.

MethodPathDescriptionAuth
GET/v1/image_prompt_templatesList — filters q, tags, hasPreview, orderByPublic
GET/v1/image_prompt_templates/{id}One templatePublic
POST/v1/image_prompt_templatesCreate (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.

MethodPathDescriptionAuth
POST/v1/actions/generateVoiceoverText-to-speech (script enhancement, styles, multi-speaker)Bearer
POST/v1/actions/editOrGenerateSimpleImageSynchronous image generate/edit — returns imageUrlBearer
POST/v1/actions/generateLogoLogoStudio — creates an image-generation record (PNG, alpha)Bearer
POST/v1/actions/generateSimpleCodeSmall code snippets for the template editorsBearer
POST/v1/actions/updateProductUsingAiCreate/update a product from natural languageBearer
POST/v1/actions/updateShippingPriceUsingAiCreate/update shipping prices from natural languageBearer
POST/v1/actions/generateListFilterUsingAiNatural language to a list filter / filteratorBearer
POST/v1/actions/generateDatePresetUsingAiNatural language to a date-range presetBearer

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.

MethodPathDescriptionAuth
POST/v1/actions/generateCustomComponentCodeJSX component + propsSchema + props (+ slots)Bearer
POST/v1/actions/editTemplatePageUsingAiFull-page structure create/edit for the template editorBearer
POST/v1/actions/generateProductLandingPageTemplateDataLanding-page TemplateData from a prompt/attachmentsBearer
POST/v1/actions/generateImageLandingPageLong image-based landing page (sectioned image)Bearer
POST/v1/actions/generateAiLandingPageAsync job: enhance prompt, generate, create the pageBearer
GET/v1/actions/getAiLandingPageJobStatusPoll job status by jobIdBearer

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

MethodPathDescriptionAuth
GET/v1/chat/modelsChat-capable models from the catalogBearer
GET/v1/chat/conversationsList — page, limit, q, archivedBearer
POST/v1/chat/conversationsCreate — modelId, optional resources, mcpServerIds, toolPolicyBearer
GET/v1/chat/conversations/{id}Detail + messages (limit, before); includes any active generationBearer
PATCH/v1/chat/conversations/{id}Update title/model/resources/MCP servers/archive/tool policyBearer
DELETE/v1/chat/conversations/{id}Delete conversationBearer
POST/v1/chat/conversations/{id}/messagesSend parts (starts a generation) or a userEventBearer
DELETE/v1/chat/conversations/{id}/messages/{messageId}Delete a messageBearer
GET/v1/chat/generations/{generationId}Snapshot + event log (sinceSeq for increments)Bearer
POST/v1/chat/generations/{generationId}/cancelRequest cancel at the next checkpointBearer
GET/v1/chat/jobs/{jobId}Background job spawned by a generationBearer
GET/v1/chat/conversations/{id}/queueList queued promptsBearer
POST/v1/chat/conversations/{id}/queueEnqueue a prompt (parts)Bearer
PUT/v1/chat/conversations/{id}/queue/reorderReorder by orderedIdsBearer
POST/v1/chat/conversations/{id}/queue/consumePop and send the next (or a specific) queued promptBearer
PATCH/v1/chat/conversations/{id}/queue/{itemId}Edit a queued promptBearer
DELETE/v1/chat/conversations/{id}/queue/{itemId}Remove a queued promptBearer
POST/v1/chat/estimateCost estimate for capability: image, voiceover, landing_page, product_ai, textBearer

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.

MethodPathDescriptionAuth
GET/v1/chat/mcp-serversList registered servers (headers masked)Bearer
POST/v1/chat/mcp-serversRegister — name, url, transport, headers, toolAllowlistBearer
PATCH/v1/chat/mcp-servers/{id}Update / clearHeadersBearer
DELETE/v1/chat/mcp-servers/{id}RemoveBearer
POST/v1/chat/mcp-servers/{id}/testProbe: reachability, auth state, tool countBearer
GET/v1/chat/mcp-servers/{id}/toolsList the server's toolsBearer
POST/v1/chat/mcp-servers/{id}/oauth/startBegin OAuth — returns authorizeUrlBearer
POST/v1/chat/mcp-servers/{id}/oauth/completeExchange the code, store tokensBearer
GET/v1/chat/mcp-servers/oauth/meta-callbackMeta Ads OAuth redirect targetPublic
GET/v1/chat/rulesList rulesBearer
POST/v1/chat/rulesCreate — name, content, enabledBearer
PATCH/v1/chat/rules/{id}UpdateBearer
DELETE/v1/chat/rules/{id}DeleteBearer
GET/v1/chat/skills/marketplacePublished skillsBearer
GET/v1/chat/skills/mineYour skillsBearer
GET/v1/chat/skills/templateStarter SKILL.md templateBearer
GET/v1/chat/skillsMerged catalog: built-ins + MCP + marketplace + yoursBearer
POST/v1/chat/skillsCreate from skillMdBearer
GET/v1/chat/skills/{id}One skillBearer
PATCH/v1/chat/skills/{id}UpdateBearer
POST/v1/chat/skills/{id}/publishPublish to the marketplaceBearer
POST/v1/chat/skills/{id}/unpublishUnpublishBearer
DELETE/v1/chat/skills/{id}DeleteBearer

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 402 with code: "INSUFFICIENT_BALANCE" and details (requiredAmount, currentBalance, breakdown); the estimate is computed exactly like the final charge.
  • Voiceover settles from actual token usage after generation and reports userCostDZD in the response metadata.
  • Chat requires a positive balance to start a generation (402 otherwise). 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/estimate to show a price before running any capability. Charges appear as ai_generation transfers in the wallet history.

On this page