Dev.to AI 🤖 Ai 👁 0 📖 1 min read

Calling Midjourney Over a Standard REST API (No Discord Bot, $0 Monthly Fee)

If you have ever tried embedding Midjourney into a web app or batch creative pipeline, you know the pain: recurring $10–$60/mo seats, expiring monthly GPU hours, and brittle Discord bot wrappers. Here is how to generate

If you have ever tried embedding Midjourney into a web app or batch creative pipeline, you know the pain: recurring $10–$60/mo seats, expiring monthly GPU hours, and brittle Discord bot wrappers.

Here is how to generate Midjourney 4-image grids over a standard OpenAI-compatible REST endpoint (POST https://modelpop.dev/v1/images/generations) with pay-as-you-go USD credits and automatic $0 charges on failed renders.

Economy vs Fast Queue Pricing ($10 Output Breakdown)

Model Price per 4-Image Grid $10 Prepaid Output Monthly Fee Failed Job Cost
midjourney-imagine-economy $0.029 / grid 344 grids (1,376 images) $0 $0 (auto-refunded)
midjourney-imagine-fast $0.040 / grid 250 grids (1,000 images) $0 $0 (auto-refunded)
Official Extra Fast GPU Ref. (~1 min/grid) ~$0.0667 / grid ~150 grids $10–$60/mo required GPU time consumed

Quickstart (cURL)

curl -X POST https://modelpop.dev/v1/images/generations \
  -H "Authorization: Bearer $MODELPOP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "midjourney-imagine-fast",
    "prompt": "Minimalist Scandinavian architectural studio bathed in golden morning light, warm oak furniture, linen textures, 35mm editorial photography --ar 16:9 --stylize 250"
  }'

Python (openai SDK)

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["MODELPOP_API_KEY"],
    base_url="https://modelpop.dev/v1",
)

res = client.images.generate(
    model="midjourney-imagine-economy",
    prompt="Luxury botanical skincare glass bottle on wet dark slate, soft rim lighting --ar 4:5",
)
print(res.data[0].url)

Full Examples & Live Pricing

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.