SDKs & Libraries
Install a library or use the OpenAI SDK you already have.
Overview
Fluxpool's API is OpenAI-compatible. Three ways to integrate:
Use the official OpenAI Python or Node.js SDK. Change base_url to api.fluxpool.ai/v1. Done.
Best for: Teams already using OpenAI.
Lightweight wrapper with Fluxpool-specific features: credit balance, model listing, webhook helpers.
Best for: Python developers wanting Fluxpool-native DX.
Same Fluxpool-native features for the Node/TypeScript ecosystem.
Best for: Node.js / TypeScript developers.
OpenAI SDK
RecommendedAlready using the OpenAI SDK? Change one line. Access 15+ image and video models.
Installation
If you don't have the OpenAI SDK installed yet:
pip install openai
Requires openai >= 1.0.0 (Python) or openai >= 4.0.0 (Node.js).
Image Generation
from openai import OpenAI
client = OpenAI(
base_url="https://api.fluxpool.ai/v1", # ← Only change
api_key="fp_your_api_key"
)
response = client.images.generate(
model="flux-1.1-pro",
prompt="A dragon perched on a neon-lit Tokyo rooftop, 8K",
size="1024x1024"
)
print(response.data[0].url)
Replace fp_your_api_key with your actual API key. Get your API key →
Video Generation
Video generation is async. Submit a job, receive results via webhook or polling.
from openai import OpenAI
client = OpenAI(
base_url="https://api.fluxpool.ai/v1",
api_key="fp_your_api_key"
)
# Submit video generation job
response = client.chat.completions.create(
model="wan-video-2.1",
messages=[{
"role": "user",
"content": "A drone shot flying through cherry blossom trees, slow motion"
}],
extra_body={
"type": "video",
"duration": 5,
"resolution": "1280x720",
"webhook_url": "https://your-app.com/webhook" # Optional
}
)
job_id = response.id
print(f"Job submitted: {job_id}")
import time
# Poll for completion
while True:
status = client.chat.completions.retrieve(job_id)
if status.status == "completed":
print(status.data[0].url) # Video URL
break
elif status.status == "failed":
print(f"Error: {status.error}")
break
time.sleep(5) # Check every 5 seconds
For production use, we recommend webhooks over polling. Webhook setup guide →
Fluxpool Python SDK
Fluxpool-native SDK with credit balance, model listing, and webhook helpers.
Installation
pip install fluxpool
Image Generation
from fluxpool import Fluxpool
fp = Fluxpool(api_key="fp_your_api_key")
# Generate an image
image = fp.images.generate(
model="flux-1.1-pro",
prompt="Isometric game village with tavern and market, pixel art",
size="1024x1024"
)
print(image.url)
print(f"Credits remaining: {image.credits_remaining}")
The SDK automatically returns your remaining credit balance with every response.
Video Generation
# Generate a video (async)
job = fp.videos.generate(
model="wan-video-2.1",
prompt="Timelapse of a cyberpunk city being built, aerial view",
duration=5,
resolution="1280x720"
)
# Wait for completion (blocking helper)
result = job.wait()
print(result.url)
Additional Features
# Check credit balance
balance = fp.credits.balance()
print(f"Credits: {balance.remaining}")
# List available models
models = fp.models.list()
for model in models:
print(f"{model.id} — {model.type} — ${model.cost_per_generation}")
# List your recent generations
history = fp.generations.list(limit=10)
Full SDK reference → GitHub README
Fluxpool Node.js SDK
TypeScript-first. Same Fluxpool-native features for Node.js and edge runtimes.
Installation
npm install fluxpool
yarn add fluxpool
# or
pnpm add fluxpool
Image Generation
import { Fluxpool } from "fluxpool";
const fp = new Fluxpool({ apiKey: "fp_your_api_key" });
const image = await fp.images.generate({
model: "qwen-image-3-6-plus",
prompt: "Anime warrior princess in bamboo forest, Studio Ghibli style",
size: "1024x1024",
});
console.log(image.url);
console.log(`Credits remaining: ${image.creditsRemaining}`);
Video Generation
// Generate a video (async)
const job = await fp.videos.generate({
model: "kling-v2",
prompt: "A koi fish transforming into a phoenix, slow motion, cinematic",
duration: 5,
resolution: "1080p",
});
// Wait for completion
const result = await job.wait();
console.log(result.url);
Additional Features
// Check credit balance
const balance = await fp.credits.balance();
console.log(`Credits: ${balance.remaining}`);
// List available models
const models = await fp.models.list();
models.forEach(m => console.log(`${m.id} — ${m.type} — $${m.costPerGeneration}`));
// With TypeScript — full type safety
import type { ImageGenerateParams, VideoGenerateParams } from "fluxpool";
Full SDK reference → GitHub README
Community SDKs
Community-maintained libraries. Not officially supported.
| Language | Package | Maintainer | Link |
|---|---|---|---|
| Go | fluxpool-go | @community | GitHub → |
| Ruby | fluxpool-ruby | @community | GitHub → |
| Rust | fluxpool-rs | @community | GitHub → |
| PHP | fluxpool-php | @community | GitHub → |
The OpenAI-compatible REST API works from any language that can make HTTP requests. See the API Reference →
REST API
No SDK needed. Any HTTP client works.
curl https://api.fluxpool.ai/v1/images/generations \
-H "Authorization: Bearer fp_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1.1-pro",
"prompt": "Product photo of sneakers on marble, studio lighting",
"size": "1024x1024"
}'
Base URL: https://api.fluxpool.ai/v1
Auth: Bearer token in Authorization header.
Format: JSON request and response bodies.