PixMind Docs
API Guides

API Quickstart

Make your first PixMind image generation request.

This is developer API documentation. It explains how to call PixMind from server-side code. To use Video to Prompt in the web product, see the Video to Prompt product guide.

1. Create an API key

Open the API Platform key dashboard, create a key, and store it in a server-side environment variable.

export PIXMIND_API_KEY="pm_live_..."

2. Stage reference media when needed

For image-to-image or image-to-video requests, upload local files through POST /api-platform/v1/files/presign before creating the generation task. This avoids third-party image hosts blocking the model provider. See Temporary media uploads for the complete flow.

3. Submit a request

curl https://aihub-admin.aimix.pro/api-platform/v1/generations \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-pro",
    "type": "image",
    "prompt": "A clean product hero image for a ceramic coffee cup",
    "aspectRatio": "1:1",
    "resolution": "1K"
  }'

The same endpoint handles every model — pass a video model id (for example veo-3.1) and it routes automatically.

4. Read the result

Image and video generation is asynchronous. Save the numeric taskId and poll GET /api-platform/v1/tasks/{taskId} until the status is ready or failed.

curl https://aihub-admin.aimix.pro/api-platform/v1/tasks/44160 \
  -H "Authorization: Bearer $PIXMIND_API_KEY"

Temporary R2 inputs bound to the task are deleted automatically when the task becomes ready or failed. Unused uploads expire after 24 hours.

5. Chat completions (LLM)

PixMind exposes an OpenAI-compatible POST /v1/chat/completions endpoint for LLM models. Set the base URL to https://aihub-admin.aimix.pro/api-platform/v1 and use your PixMind API key as the Bearer token.

curl https://aihub-admin.aimix.pro/api-platform/v1/chat/completions \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.5-flash",
    "messages": [
      { "role": "user", "content": "Explain diffusion models in one sentence." }
    ]
  }'

Gemini image and video input

Gemini routes accept OpenAI-style content arrays with text, image_url, and video_url blocks. URLs must use HTTPS. A request can include up to 10 images (10MB each) and one video (20MB).

curl https://aihub-admin.aimix.pro/api-platform/v1/chat/completions \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.5-flash",
    "messages": [{
      "role": "user",
      "content": [
        { "type": "text", "text": "Compare the product image with the motion in the video." },
        { "type": "image_url", "image_url": { "url": "https://example.com/product.png" } },
        { "type": "video_url", "video_url": { "url": "https://example.com/motion.mp4" } }
      ]
    }]
  }'

OpenAI SDK

Because the API is OpenAI-compatible, you can drop it into the official SDK:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.PIXMIND_API_KEY,
  baseURL: "https://aihub-admin.aimix.pro/api-platform/v1",
});

const response = await client.chat.completions.create({
  model: "gemini-3.5-flash",
  messages: [{ role: "user", content: "Explain diffusion models in one sentence." }],
});

console.log(response.choices[0].message.content);

Streaming

Pass stream: true to receive a Server-Sent Events stream of chat.completion.chunk deltas, terminated by data: [DONE]:

const stream = await client.chat.completions.create({
  model: "gemini-3.5-flash",
  messages: [{ role: "user", content: "Write a haiku about the ocean." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

On this page