All posts
AI Development

Build Custom AI Chatbots That Create Media with the Flixly API

Flixly's API doesn't generate chat text, but it can give your custom chatbot image, video and voice generation. This tutorial shows how to wire it into the language model you already use.

By Flixly TeamMarch 26, 2026
Build Custom AI Chatbots That Create Media with the Flixly API

TL;DR

Flixly has no text chat or LLM completion API. Build the conversation with your existing language model provider, then call Flixly's REST API (POST /api/v1/generate, GET /api/v1/generations/{id}) when a user asks for an image, video or voice clip. Authenticate with an API key, pick model ids from GET /api/v1/models, and use webhooks or polling for results. Usage is paid from credits bought in one-time packs.

Businesses and developers keep adding custom AI chatbots to their sites and apps to answer questions, guide users and automate support. The next step many teams want is a bot that can also make things: a product image, a short video, a spoken reply. That is where the Flixly API fits in.

One thing to be clear about up front: Flixly does not offer a text chat or LLM completion API. The conversation itself comes from the language model provider you already use. Flixly's API adds image, video and audio generation on top, so your chatbot can hand users real media instead of just text. This chatbot development tutorial shows how to connect the two.

Why Add the Flixly API to Your Chatbot?

A text-only bot can describe a picture; a media-capable bot can deliver one. The Flixly API gives you:

  • One key, many models: image, video and audio models from the catalog behind a single REST API. Browse them in the models directory.
  • Simple endpoints: start a job with POST /api/v1/generate, check it with GET /api/v1/generations/{id}.
  • Webhooks: get notified when a generation completes.
  • Guardrails: per-key rate limits and monthly spending caps you can set per key.
  • Pay per use: credits from one-time packs, with no plan to commit to.

Prerequisites

Before writing code, make sure you have:

  • A Flixly account (sign up).
  • A Flixly API key, created under API keys.
  • An account with a language model provider for the chat replies.
  • Node.js 18 or newer (for built-in fetch) or Python.
  • Optional: a frontend framework like React for the UI.

Step 1: Setting Up Your API Access

  1. Create a Flixly account and add credits from the pricing page if your starter grant runs low.
  2. Generate an API key in your dashboard settings.
  3. Store keys securely in a .env file:
FLIXLY_API_KEY=your_flixly_key_here
LLM_API_KEY=your_llm_provider_key_here

Never expose either key in browser code; all calls below run on your server.

Step 2: Making Your First Flixly API Call

Start a generation. Model ids come from GET /api/v1/models; here we use GPT-Image 2.0 (gpt-image-2):

import 'dotenv/config';

const BASE = 'https://www.flixly.ai/api/v1';
const headers = {
  'Authorization': `Bearer ${process.env.FLIXLY_API_KEY}`,
  'Content-Type': 'application/json'
};

export async function startImage(prompt) {
  const res = await fetch(`${BASE}/generate`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ model: 'gpt-image-2', prompt })
  });
  if (!res.ok) throw new Error(`Flixly error ${res.status}`);
  return res.json(); // { id, status, ... }
}

The response includes the generation id and a status. Some jobs finish immediately; others return processing.

Step 3: Getting the Result

Poll the status endpoint until the job is completed or failed:

export async function waitForResult(id) {
  while (true) {
    const res = await fetch(`${BASE}/generations/${id}`, { headers });
    const job = await res.json();
    if (job.status === 'completed') return job.output_url;
    if (job.status === 'failed' || job.status === 'blocked') throw new Error(job.error);
    await new Promise(r => setTimeout(r, 3000));
  }
}

For production, pass a webhook_url in the generate request and let Flixly notify your server instead. See the webhooks guide.

Step 4: Connecting It to the Conversation

Your language model handles the dialogue. When it detects a media request, your backend calls Flixly:

async function handleMessage(history, message) {
  const wantsImage = /\b(draw|generate|create) (an? )?(image|picture)\b/i.test(message);
  if (wantsImage) {
    const job = await startImage(message);
    const url = job.output_url ?? await waitForResult(job.id);
    return { type: 'image', url };
  }
  // Otherwise call your LLM provider with the conversation history
  return { type: 'text', text: await callYourLLM(history, message) };
}

A keyword check is only a starting point. Many LLM providers support tool or function calling, so you can describe a generate_image tool and let the model decide when to call it.

Voice and Video Replies

The same endpoint covers audio and video models. Pick a text-to-speech model such as Gemini 3.1 Flash TTS or a video model such as Seedance 2.0 from the model list, then pass the model's id with your prompt.

Step 5: Creating a Web Interface

A minimal frontend posts messages to your backend and renders text or media:

<div id="chat-container">
  <div id="messages"></div>
  <input id="input" type="text" placeholder="Type your message...">
  <button id="send">Send</button>
</div>
<script>
  // POST the message to your server, then append text,
  // an <img>, <video> or <audio> element based on the reply type
</script>

Step 6: Deployment and Scaling

  • Host your backend on any Node.js platform.
  • Use webhooks rather than tight polling loops.
  • Set spending caps on each API key so a busy bot can't drain your balance.
  • Handle errors: a request your balance can't cover returns an insufficient-credits error, so show users a friendly message.

The full reference, including the OpenAPI spec, is in the API docs and the developer portal.

Best Practices

  • Confirm before generating: media costs credits, so let users approve expensive requests.
  • Rate limiting: respect the per-key limits and queue requests on your side.
  • Moderation: filter prompts before sending them to either API.
  • Privacy compliance: avoid sending personal data in prompts and follow GDPR.
  • Testing: try failed, blocked and slow jobs, not just the happy path.

Conclusion

Flixly won't write your chatbot's replies, but it can make your custom AI chatbot far more useful by letting it create images, videos and voice clips on request. Pair your language model with the Flixly API, start with a single image model, and expand from there. Get your key and read the API docs to begin.

Frequently Asked Questions

What is the Flixly API?▾

The **Flixly API** is a REST API for generating images, video and audio with the models in Flixly's catalog. It exposes endpoints to start a generation, check its status, list models and read your account. It does not provide text chat or LLM completions.

Can Flixly power the chatbot's text replies?▾

Not from Flixly. Flixly's former text chat endpoint has been retired. Use any language model provider for the conversation, and call Flixly when the bot needs to produce media.

Do I need coding experience to build this?▾

Basic programming knowledge helps. The examples here use Node.js and plain HTTP requests, so they translate easily to Python or other languages.

How much does the Flixly API cost?▾

Generations are paid with credits bought in one-time packs, and cost depends on the model and settings. New accounts receive a small starter credit grant for testing. See the pricing page for current packs.

Can I integrate the chatbot with websites or apps?▾

Yes. Your backend calls the Flixly API, so the chatbot can live in any website or app. Use webhooks to get notified when a generation finishes instead of polling.

custom AI chatbotFlixly APIchatbot development tutorialAI image generation APIchatbot media generation

Ready to create with AI Development?

Jump straight into Flixly's AI studio and try ai development with 50+ models — free to start.