DEV Community

Cover image for How to Use Muse AI With the PixAI API: Script Setup, Prompts, and Batch Runs
Abirami Vina
Abirami Vina

Posted on Originally published at Medium

How to Use Muse AI With the PixAI API: Script Setup, Prompts, and Batch Runs

I tested how to use Muse AI with the PixAI API, connecting Meta’s Muse agent to generate one anime test image and a 4-image batch with real prompts and costs.


I just created five anime images of one original character, and I didn’t type a single one of those requests into PixAI, an anime-focused AI image generator. Muse, Meta’s personal AI agent, did.

Muse chat showing how to use Muse AI with PixAI, confirming four image tasks above five anime illustrations of a silver-haired girl with a clear umbrella in different rainy locations.

Here’s how to use Muse AI with PixAI in practice. Muse confirmed my batch request before running it, and the Tsubaki.3 model produced these five images from one workflow.

It’s a great example of how to use Muse AI for something practical. I asked it to write a small script, test one image through the PixAI API, then draft four scene variations and run them once I’d approved the list. I wanted the prompt-writing and request-sending handled for me, without pasting each prompt into PixAI by hand.

A few other products share the Muse name, so to be clear, this is Meta’s agent. It runs tasks on its own cloud computer and checks with you before sensitive actions like sending emails or making purchases.

In this workflow, Muse prepares and coordinates the tasks, while PixAI generates the images. I followed PixAI’s official Muse × PixAI API guide and ran the whole process on November 19, 2026, using Muse on the web.

Let’s take a closer look at how it all works. You can set this up without any coding experience, and I’ll walk you through the few steps Muse can’t do for you.

Disclosure: This article was created in collaboration with PixAI. It also includes my PixAI referral link. If you sign up through it and complete the qualifying steps, we both receive bonus credits, and I may earn extra credits if you top up later. It costs you nothing.

What You Need Before Using Muse AI with PixAI

Before Muse can send a single request to PixAI, you need four things in place. These are a Muse account, a PixAI account with API access, enough credits for a test run (each API image cost me 4,000), and a model that works through the API. Let’s go through them one at a time.

Muse Access and Usage Limits

Start with Muse itself, since it handles all the coordinating. I used Muse’s Free plan on the web. Muse is free for most uses, with paid plans for longer or more complex tasks.

After the full test, the General tab in Muse’s settings still showed 0% of my weekly limit used. Muse availability depends on your region and account, so confirm you can sign in before going further.

PixAI Membership vs Credits: What Each One Gives You

Next is PixAI. These four terms get mixed up a lot, so here’s what each one means before you create a key:

  • Registration gives you a free PixAI account, which you can use to generate images on PixAI’s website with daily free credits.
  • Membership is a paid plan with monthly bonus credits and instant API keys.
  • API access is permission to use a key, through membership or an approved email request.
  • Credits pay for every generation, on the website or through the API.

Non-members currently get 10,000 free credits a day, and paid plans add larger monthly allowances. The API doesn’t cover every website feature yet, though. Features like Reference Pro, PixAI Edit, and Edit Lite aren’t available through the API for now.

How to Get PixAI API Access and an API Key

Once you know where you stand, you can get your key. If you’re new to APIs, here’s the quick version. An API is a way for another tool, in this case Muse, to request images from PixAI without going through the website. The API key is the credential that authorizes those requests, so treat it like a password.

There are two ways to get PixAI API access:

  • With a membership, you create a key yourself and it’s ready immediately.
  • Without one, you email api@withpixai.art with your organization, role, expected usage and use case, then wait up to 5 business days for review.

Both types of keys work the same way. I have a Starter membership, so I opened my PixAI settings, went to API Platform and clicked New API key. The dialog lets you name the key and choose when it expires (7, 30, or 90 days, 1 year, or a custom date). The full key appears only once, so copy it into a password manager straight away.

PixAI API Platform settings page listing an API key with a blurred secret, above the Create API key dialog with name and expiry options.

Members can create an API key in Settings under API Platform, choose how long it lasts, and copy it right away because it’s shown only once.

Test Your Model and Prompt on the PixAI Website First

With your key saved, there’s one last thing to do before involving Muse. I generated one sample on PixAI’s website to settle the model and prompt. Iterating there is quicker than debugging a script.

I used Tsubaki.3 on Pro quality at 2:3 (816×1232), one image, with Prompt Helper on and the prompt below:

An anime illustration of a young woman with a short silver bob and amber eyes, wearing an oversized navy raincoat with a small yellow star pin on the collar. She stands under a bus stop shelter on a rainy evening, holding a clear umbrella, with soft streetlight reflecting on the wet pavement.
Enter fullscreen mode Exit fullscreen mode

For the negative prompt, I used:

lowres, worst quality, low quality, bad anatomy, explicit
Enter fullscreen mode Exit fullscreen mode

The image cost 3,000 credits. The API also needs the model’s version ID. I copied “2024383379556065549” from the Tsubaki.3 model page URL, and it matches PixAI’s list of API model version IDs. URL numbers and version IDs don’t always line up, so check your model there.

PixAI website image generator with Tsubaki.3 selected, the prompt entered, and a 3,000-credit cost, next to an anime girl at a rainy bus stop.

My website test used Tsubaki.3 on Pro quality, and the generate button showed a cost of 3,000 credits for one image.

Once you have a model, prompt, and model ID you’re happy with, you’re ready to bring Muse in.

Muse AI Tutorial: Connect Muse to the PixAI API Step by Step

Now for the setup itself. Muse writes the script, but you add the key yourself and approve each run. This is a custom workflow built on PixAI’s public API, not an official Muse–PixAI connector, so you’ll guide Muse through it with five instructions. Send each one separately and let Muse finish before moving on.

Step 1: Create the Project Folder and Key File

First, give Muse a place to work. This instruction creates a project folder and an empty file for your API key, so the key never has to go through the chat:

Create a folder named pixai-batch in my workspace. Inside it, create a file named Sample.env.txt containing a single line: PIXAI_API_KEY=

Leave the value empty. Do not ask me for the key in chat. I will add it myself.
Enter fullscreen mode Exit fullscreen mode

Step 2: Add Your API Key Without Pasting It Into Chat

Next, add your key to the file by hand. In Muse, open Library, go to System files, and find “Sample.env.txt” inside the pixai-batch folder. Paste your key right after the “=” with no spaces, then save. Don’t paste the key into chat, and don’t ask Muse where the file is. I did, and the reply exposed my key (we’ll explore that in a little bit).

Muse chat confirming a new pixai-batch folder with a Sample.env.txt file, above the file open with the API key value hidden.

Muse created the folder and an empty key file, and I pasted the key into the file myself instead of the chat.

Step 3: Rename the File to .env

Now the file needs its proper name. A “.env” file is the standard place for a script to read secrets like API keys from, and it’s where Muse’s script will look. Use the following prompt:

Rename pixai-batch/Sample.env.txt to .env. Confirm the file exists and contains a PIXAI_API_KEY line. Do not print, preview, attach, or quote the file or any part of its contents in chat.
Enter fullscreen mode Exit fullscreen mode

Muse confirmed the file was there without showing what was inside. If “.env” disappears from Muse’s web view after renaming, the file is still there, and the web view just hides it.

Step 4: Add Your First Prompt to prompts.csv

With the key in place, Muse needs something to generate. A CSV file holds one prompt per row, which makes it easy to add more prompts later for a batch. Paste in the prompt you tested on the website.

In pixai-batch, create prompts.csv with one prompt per row. Wrap any prompt containing commas in double quotes. Add this as row 1:

[your website-tested prompt]
Enter fullscreen mode Exit fullscreen mode

If Muse’s preview of the file looks broken, with your prompt split across several columns, don’t worry. We’ll discuss that in the troubleshooting section below.

Step 5: Have Muse Write the Script and Confirm It’s Ready

This is the longest instruction, but each rule has a job. Some keep your key private, some lock in the settings from your website test, and the rest stop the script from resubmitting a task and charging you twice.

Read the official PixAI API documentation:
https://platform.pixai.art/en/docs
https://platform.pixai.art/en/docs/api-v2/image/createImage

Then write a script in pixai-batch that generates images through the PixAI API, following these rules:
- Read the API key from .env. Never print, log, or display it.
- Use these fixed settings for every request: modelVersionId 2024383379556065549, mode "pro", aspectRatio "2:3", size "1k", batchSize 1, promptHelper "enable", negativePrompt "lowres, worst quality, low quality, bad anatomy, explicit".
- Read prompts from prompts.csv and submit one task per row.
- As soon as a task is accepted, log the row number and task ID to tasks.log. Treat both 200 and 201 as success.
- Poll task status no more often than every 3 seconds, with a 120-second timeout.
- If a request times out, do not resubmit it. Log the row to failed_tasks.log and tell me.
- Add a --task-id option that checks and downloads an existing task without creating a new one.
- Save finished images to an output folder, named by row number, using the file format the API actually returns.
- Record each task's paidQuota value in tasks.log.

Do not run anything yet. When the script is ready, tell me which endpoints it uses, list the fixed settings and the number of tasks it would submit, and confirm the key is never printed.
Enter fullscreen mode Exit fullscreen mode

Muse’s reply is your readiness check. Mine named the endpoints (POST /v2/image/create to submit, GET /v2/task/{id} to poll), listed the fixed settings, reported one task queued, and confirmed the key is never printed. If anything doesn’t match your website test, fix it before running.

Muse chat reply saying the PixAI script is ready, with a preview of generate_images.py and the API endpoint it uses.

Muse wrote the script, explained which PixAI endpoints it would call, and confirmed that nothing had run yet.

With the script written and checked, you’re ready to generate your first image.

Muse AI Image Generation: Your First Anime Image with PixAI

Before running a whole batch, generate a single image. If something in the setup is wrong, you’ll only lose one image’s worth of credits, and you can compare the result with your website test. Here’s the instruction I sent:

Run generate_images.py for row 1 only. Generate one image and stop. After it finishes, report the task ID, the final task status, the paidQuota value, the saved file path, the file format and pixel dimensions, and the seed if the API returned one. Do not submit any other tasks. Wait for my review before doing anything else.
Enter fullscreen mode Exit fullscreen mode

The script used the fixed settings from Step 5, so the request went out with Tsubaki.3 on Pro mode, a 2:3 aspect ratio at the 1k size, one image per task, Prompt Helper on, and the same negative prompt as my website test.

The task finished in roughly 10 to 15 seconds and saved as “output/1.webp” at 848×1280. To keep a copy, I opened the image in Muse and clicked Download in the viewer.

How to Tell the Connection Worked

So how do you know everything is working? Muse’s report should include:

  • a task ID
  • a completed status
  • a saved file in your output folder
  • a paidQuota value that matches the drop in your credit balance

Mine reported 4,000, and my balance went from 908,500 to 904,500. I also checked my public generation history, and the image wasn’t there. That’s expected, since images generated through the API are private.

Muse chat reporting a completed PixAI task with task ID, paidQuota 4000, and a WebP file path.

Muse reported the first API image with a paidQuota of 4,000, which matched the drop in my balance.

PixAI Website vs API: What Changed in My Test

I used the same prompt and model as my website test, but the results weren’t identical:

  • The website charged 3,000 credits, while the API charged 4,000.
  • The website image was 816×1232, and the API image was 848×1280.
  • The website gave me a hooded profile shot, while the API produced a low-angle view with a collared coat.

If you’re budgeting credits for a batch, go by your first API result rather than the website price.

Side-by-side comparison of two anime images of the same silver-haired girl at a rainy bus stop

The same prompt and model gave a hooded profile shot on the website but a low-angle, collared-coat version through the API.

Once your single image looks right, you’re ready to scale up to a batch.

How to Batch-Generate Anime Images with Muse AI

This is where Muse saves the most time. Instead of writing and submitting each prompt yourself, you ask Muse to draft the variations, check them, and then let it run the whole set. I kept the same character and settings and changed only the location, which took three more instructions.

Ask Muse to Draft the Prompt List

The most important part of this instruction is the character description. Asking Muse to keep it word for word at the start of every prompt gives the model the best chance of drawing the same character each time.

Draft 4 new prompts and add them to prompts.csv as rows 2–5. Keep this character description word for word at the start of every prompt:

"An anime illustration of a young woman with a short silver bob and amber eyes, wearing an oversized navy raincoat with a small yellow star pin on the collar."

Change only the location in each prompt. Keep it a rainy evening and keep the clear umbrella. Do not change row 1 and do not run anything. Show me all four prompts in full so I can review them.
Enter fullscreen mode Exit fullscreen mode

Muse added these four prompts as rows 2 to 5. Each one starts with the same character description, which I’ve shortened here to keep the list readable.

2. [character description] She stands on a quiet train station platform on a rainy evening, holding a clear umbrella, with soft light from the station signs reflecting on the wet platform.
3. [character description] She stands outside a small bookstore on a rainy evening, holding a clear umbrella, with warm light from the shop windows reflecting on the wet sidewalk.
4. [character description] She stands on a stone bridge over a narrow canal on a rainy evening, holding a clear umbrella, with soft streetlight reflecting on the wet bridge and the water below.
5. [character description] She stands at the entrance to a small city park on a rainy evening, holding a clear umbrella, with soft lamplight reflecting on the wet path and fallen leaves.
Enter fullscreen mode Exit fullscreen mode

Muse chat with a request to draft four batch prompts and Muse’s reply listing the first prompt for a train station platform.

I asked Muse to draft four prompts that kept the character description word for word and changed only the location, then reviewed them before anything ran.

Review the List and Approve the Run

Before spending any credits, read through the drafts. I checked that the character description was identical in all four and approved them as written. Then I asked Muse to confirm the plan before submitting anything.

Prepare to run generate_images.py for rows 2–5 only. Do not resubmit row 1. Before submitting anything, tell me the number of tasks and the fixed settings, then wait for my approval.
Enter fullscreen mode Exit fullscreen mode

Muse reported four tasks and, without being asked, added a --rows 2-5 filter so row 1 couldn’t run again. With the plan confirmed, I sent the go-ahead.

Approved. Run rows 2–5. When finished, list each row's task ID, status, paidQuota, saved file path, and seed, plus the total paidQuota and any failures or retries. Then zip the output folder so I can download all the images at once.
Enter fullscreen mode Exit fullscreen mode

Batch Results and Credit Cost

All four tasks were completed, with no failures or retries. Each one cost 4,000 credits:

  • Row 2, train station platform
  • Row 3, small bookstore
  • Row 4, canal
  • Row 5, city park entrance

The batch cost 16,000 credits in total, taking my balance from 904,500 to 888,500, which matched the paidQuota values. Based on the file timestamps, it took about 1 to 2 minutes.

My whole test cost 23,000 credits, with 3,000 for the website sample and 20,000 for the five API images. To download everything, I clicked the ZIP file Muse attached and then clicked Download.

Why the Character Still Drifts Across a Batch

The results were good, but they weren’t perfectly consistent. Every image kept the silver bob, amber eyes, navy coat, star pin, and clear umbrella.

Other details wandered. The coat switched between hooded and collared styles. The canal prompt asked for a stone bridge but put her standing in the water, wearing rubber boots I never asked for. The station sign also has garbled text.

That’s because batch generation repeats your description, but it doesn’t make the model draw the character the same way each time. If consistency matters for your project, try one of these beginner methods for keeping a character consistent.

Four anime illustrations of the same character at a train platform, bookstore, canal, and park entrance in the rain.

Only the location changed between these four images, yet the canal scene put her in the water and added boots I never asked for.

The batch itself ran without errors, but I did run into a few problems during setup. Here’s how to handle them if they happen to you.

Troubleshooting Muse and PixAI API Problems

The first two problems below happened during my setup. I triggered the next two on purpose to see what they look like, and the last one comes from PixAI’s documentation.

My API Key Showed Up in the Muse Chat

This was my own mistake. When I asked Muse where my key file was, it replied with a file card whose preview showed the full key. Anything in chat stays in your conversation history, so avoid asking Muse about the file at all.

Open it yourself by going to Library and then System files. If your key does appear in chat, delete it in your PixAI API Platform settings and create a new one.

The prompts.csv Preview Looked Broken

After Muse created prompts.csv, its preview showed my prompt split across four columns. Before running anything, I asked Muse to check the file itself. It confirmed the prompt was stored as one field in quotes, and the preview was simply splitting the text at each comma.

Wrong or Unsupported Model ID (404 Not Found)

To see what a bad model ID looks like, I gave a temporary copy of the script the model ID 123. The API returned “404 Not found”; no task was created, and my balance didn’t change. If you see this error when submitting, check your ID against the list of API model version IDs first.

A Request Timed Out: Check the Task Before Resubmitting

A timeout doesn’t mean the task failed. It may still be processing, and resubmitting could charge you twice. That’s why the script logs every task ID and never retries on its own. Instead, ask Muse to check the existing task.

Run generate_images.py with --task-id [your task ID] --row 1 to check the existing task and download its image again. Do not create a new task. Report the status and whether any new task was submitted.
Enter fullscreen mode Exit fullscreen mode

When I tested this on my first task, Muse re-checked it, downloaded the image again and created nothing new. My balance stayed at 888,500. To avoid problems in the first place, poll no more than once every 1.5 seconds and keep to 10 waiting tasks or fewer.

Two Muse chat replies side by side, one confirming an existing PixAI task was re-checked without creating a new one and one showing a 404 Not found error for a wrong model ID.

Re-checking an existing task created nothing new and cost no extra credits, while a wrong model ID returned a 404 and no task was created.

Authentication Errors and Expired Keys

I didn’t run into these, so this part is based on PixAI’s documentation. If authorization fails, the API returns a 401 Unauthorized error.

Check that your “.env” file holds the right key with no extra spaces, and that the key hasn’t passed its expiry date in your API Platform settings. Also, PixAI doesn’t keep generated media forever, so download your results promptly.

That covers the problems you’re most likely to run into.

Muse AI and PixAI API FAQ

Here are answers to a few common questions about using Muse with the PixAI API:

  • Can I learn how to use Muse AI without programming experience? Yes. Muse wrote and ran the Python script for me, so I didn’t write any code. You’ll still need to create the API key, paste it into the file yourself, and approve each run.
  • What can I try for free, and what needs API access or credits? Muse’s Free plan covered my whole test, and you can try models on PixAI’s website using daily free credits. Generating through the API is different. You’ll need a membership or an approved email request for access, and every API image uses credits.
  • Will images generated through the PixAI API appear in my public history? No. API-generated images are kept private, and none of my five API images showed up in my public history.

Next Steps: How to Use Muse AI for Your Own Anime Art

Now you know how to use Muse AI with PixAI. By the end of my test, Muse had written the script, drafted the scene prompts, and sent every request, while PixAI generated five images of the same character from one workflow.

If you’d like to try it yourself, I’d go in this order:

  1. Create or sign in to your PixAI account.
  2. Test a model and prompt on the website until you like the result.
  3. Confirm your API access and create a key.
  4. Follow the steps above to generate one image through Muse before running a batch.

If you’re new to PixAI, you can sign up through my referral link. Once you’ve verified your email (for email sign-ups), claimed the Daily Reward on two separate days, and generated your first image, we each get 50,000 credits.

I also earn 10% back in credits if you top up later. Signing up doesn’t unlock API access on its own, but at the 3,000 credits my website test cost, those credits cover about 16 website tests while you settle on a model and prompt. You can read the full referral terms before signing up.

Top comments (0)