Migrate from the OpenAI Image API to PixelFireman | PixelFireman
Migration guide

Migrate from the OpenAI image API to PixelFireman.

You are already generating images with OpenAI (DALL·E 3 or gpt-image-1). PixelFireman is a standard REST image API with Bearer auth, so for most integrations you change the base URL and one response-reading line.

The short version: keep your prompt, point at https://pixelfireman.com/v1/images, send your pixelfireman_com_live_ key, and read data.image instead of data.data[0].url. Branch on format (url vs svg) and read creditsUsed to track spend.

More details

How the migration works

This is the whole move, in order: keep your existing prompt, change the endpoint URL, swap the Bearer key, and read a flat response. Below you will find the before/after code, every request parameter and response field mapped, unsupported features and what to do instead, and error handling, so there are no surprises when you flip the switch.


Before / after: a working example

The same “generate and save a PNG” task, in Node 18+ fetch.

BEFORE OpenAI
import fs from "node:fs";
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

const r = await openai.images.generate({
  model: "dall-e-3",
  prompt: "a red fox sitting in autumn leaves",
  size: "1024x1024",
  n: 1,
});

const url = r.data[0].url;
const img = await fetch(url);
const buf = Buffer.from(await img.arrayBuffer());
fs.writeFileSync("output.png", buf);
console.log("Saved output.png");
AFTER PixelFireman
import fs from "node:fs";

const API_KEY = process.env.PF_API_KEY;

const res = await fetch(
  "https://pixelfireman.com/v1/images", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "a red fox sitting in autumn leaves",
    mode: "generate",
    size: "1024x1024",
  }),
});

if (!res.ok) {
  const e = await res.json().catch(() => ({}));
  throw new Error(`HTTP ${res.status}: ${e.error}`);
}

const data = await res.json();
console.log("credits used:", data.creditsUsed,
            "left:", data.usage.creditsLeft);

if (data.format === "url") {
  const img = await fetch(data.image);
  const buf = Buffer.from(await img.arrayBuffer());
  fs.writeFileSync("output.png", buf);
} else {
  fs.writeFileSync("output.svg", data.image);
}
console.log("Saved output");

The real changes: no SDK, the endpoint URL, read data.image (not data.data[0].url), and branch on data.format. Everything else is your existing prompt and size.

Why switch
  • Cost. A 1024×1024 image is 1 credit. At the $800 Pro pack that is about $0.0061 per image, up to 12× cheaper than OpenAI’s premium image tiers of $0.04 (DALL·E 3, 1024×1024, standard quality). Credits are prepaid and never expire.
  • Same workload, lower cost. Generate images for the same publishing workload, articles, blogs, news, SEO pages, directory listings and feeds, at a lower cost.
  • No SDK lock-in. It is one POST with a JSON body. Any HTTP client works.
  • Vector mode. Ask for flat SVG logos/icons with mode: "draw", something the OpenAI image API does not return.
Request parameter mapping

OpenAI’s POST /v1/images/generations maps to PixelFireman’s POST /v1/images:

OpenAIPixelFiremanNotes
promptpromptSame. Keep your prompt text as-is.
model (e.g. "dall-e-3", "gpt-image-1"), (omit)PixelFireman picks the engine. The model field here means your own trained style model id, not an OpenAI model name. Drop the OpenAI model string.
size ("1024x1024", "1024x1792", "1792x1024")size ("1024x1024", "1024x1536", "1536x1024")Same WIDTHxHEIGHT string format. Use PixelFireman’s nearest ratio. Max 2048×2048. Credits scale with megapixels.
n, (not supported)One image per call. Loop the request n times client-side.
quality ("standard"/"hd"), (not supported for photos)No photo quality switch. (draw mode accepts quality: "high" for richer SVG only.)
style ("vivid"/"natural"), (fold into the prompt)Express style in the prompt text, e.g. “natural lighting, muted colours”.
response_format ("url"/"b64_json"), (always a URL or SVG)No base64 option. Read format + image (see below) and download the URL if you need bytes.
, (none)mode ("auto"/"generate"/"draw")New. generate = photo, draw = flat SVG vector, auto = server picks. Defaults to auto.
Authentication mapping

Both use a Bearer header, so this line barely changes:

OpenAIPixelFireman
Authorization: Bearer sk-...Authorization: Bearer pixelfireman_com_live_...
OpenAI-Organization header, (not used)

PixelFireman also accepts x-api-key: pixelfireman_com_live_... as an alternative. Get your key in the account dashboard.

Response field mapping

OpenAI nests the result under data[]. PixelFireman returns a flat object, read image directly and lead on creditsUsed for billing.

OpenAIPixelFiremanNotes
data[0].urlimage (when format === "url")Flat, not an array. One image per call.
data[0].b64_json, (none)No base64. Fetch the image URL to get bytes.
data[0].revised_prompt, (none)Not returned.
, (billed on your OpenAI invoice)creditsUsedWhat this call cost you, in credits. Read this to track spend.
, (none)usage.creditsLeftYour remaining balance after the call.
, (none)format ("url"/"svg")Always branch on this before using image.
, (none)engine, costInformational. cost is our internal provider cost in USD, not your price, you pay in credits. Safe to ignore.
Unsupported features & how to handle them
OpenAI featureOn PixelFiremanWhat to do
n > 1 (batch)Not supportedLoop the request. Respect the limits: 120 requests/min and 6 concurrent per key.
b64_json responseNot supportedFetch the returned image URL to get bytes.
Image edits / inpainting (/images/edits)Different endpointUse POST /v1/images/edit with images[] (data URIs or https URLs). Costs more credits per megapixel. See the API docs.
Variations (/images/variations)Not supportedRe-prompt, or train a custom style model for a consistent look.
quality: "hd", styleNot supported for photosFold intent into the prompt text.
Streaming / partial imagesNot supportedSingle response per call.
Error handling mapping

Both return a JSON body on error. OpenAI nests it under error.message; PixelFireman returns a flat { "error": "..." }. Status codes line up closely:

StatusOpenAIPixelFiremanHandling
400Invalid requestMissing prompt or size over 2048×2048 capFix the body. Do not retry unchanged.
401Bad API keyInvalid or missing keyCheck the Authorization header. No credits charged.
402, (billing via plan)Out of credits (noCredits: true)Top up in the dashboard. May include creditsNeeded.
429Rate limitRate (120/min) or concurrency (6) limitBack off and retry; a Retry-After header is set.
400/451Content policy (content_policy_violation)Moderation block, 451 (moderated: true)Reword the prompt and retry. The message starts with Blocked:.
500Server errorServer errorRetry with exponential backoff. No credits charged on failure.

A migration-friendly read: OpenAI code that checks res.ok and reads err.error.message should read err.error (a string) on PixelFireman. Billing never happens on a failed, blocked, or unauthorised request.

Quality tradeoffs, stated plainly

PixelFireman photo generation runs on a fast, efficient open model, different from DALL·E 3 / gpt-image-1. Honest expectations:

  • Great fit: article heroes, blog illustrations, news thumbnails, SEO and listing imagery, social feeds, product mockups, placeholder/visual-filler at volume, anywhere you need a fitting image fast and cheap.
  • Different, not strictly better or worse: composition and literal prompt-following differ between models. Expect to tweak a few prompts when you switch.
  • Where premium models can still win: dense text rendering inside the image, highly cinematic or stylised art direction, and some complex multi-subject scenes. For those, keep a premium model on that specific path and use PixelFireman for the high-volume rest.
  • Vector art: for flat logos and icons, mode: "draw" returns clean SVG, which OpenAI’s image API does not do.

The goal is not “identical output”, it is generating images for the same publishing workload at a lower cost.

Pricing at a glance
PackPriceImage creditsPer 1,000
Starter$253,800~$6.58
Plus$15023,200~$6.47
Pro$800132,000~$6.06

A 1024×1024 image is 1 credit; credits scale with megapixels (rounded up, min 1). Best rate ($0.0061 / image) is on the $800 Pro pack. Prepaid, no subscription, credits never expire. The up-to-12× comparison is against OpenAI’s premium image tiers (DALL·E 3, 1024×1024, standard quality, as of October 2026).

Up to 12× cheaper on images — ~0.6¢ / image at the Pro pack vs ~4¢ on premium APIs.
Questions
How hard is it to switch?

For most integrations you change the base URL and the response-reading line. It is a standard REST endpoint with Bearer auth: POST a prompt, read the image field back. There is no SDK to adopt.

Does it return a URL or base64 like OpenAI?

A hosted https URL in the image field by default (format: url), or raw SVG markup in draw mode (format: svg). There is no b64_json / response_format option, so always branch on format.

What is different about the price?

Prepaid credits that never expire. A 1024×1024 image is 1 credit; credits scale with megapixels. At the $800 Pro pack that is about $0.0061 per image, up to 12× cheaper than OpenAI’s premium image tiers.

Is the quality the same as DALL·E 3?

It is a different model, purpose-built for high-volume publishing — fast and well suited to articles, blogs, SEO pages, listings and feeds. For cinematic or highly stylised art, premium models may render more detail. PixelFireman is built to generate images for the same publishing workload at a lower cost.

Ready to switch?

Grab a pixelfireman_com_live_ key, change your base URL to https://pixelfireman.com/v1/images, and read data.image. The full reference, including async video and custom models, is in the docs.