Flux Image Generation Server
About
A simple HTTP server that calls the Flux Schnell model on Replicate to generate images from text prompts.
Details
- Author
- caok
- Downloads
- 390
- Categories
- Media
Jump to
- Wraps Replicate’s Flux Schnell model in a local HTTP server
- Accepts text prompts and returns generated image data
- Simple JSON API – one endpoint, no extra configuration
- Runs on port 3000 after build and start commands
- Returns success/error responses in a consistent format
Install dependencies via npm install, set the REPLICATE_API_TOKEN environment variable, compile with npm run build, then start with npm start. The server listens on port 3000 and provides a single POST endpoint at /generate that accepts a JSON body with a prompt field.
Flux Image Generation Server
这是一个简单的HTTP服务器,用于调用Replicate的Flux Schnell模型生成图片。
安装
npm install
配置
在运行服务器之前,你需要设置Replicate API token作为环境变量:
export REPLICATE_API_TOKEN=your_token_here
运行服务器
编译并启动服务器:
npm run build
npm start
服务器将在端口3000上运行。
API使用
服务器提供了一个简单的HTTP API端点来生成图片:
生成图片
请求
POST http://localhost:3000/generate
Content-Type: application/json
{
"prompt": "your image description here"
}
示例
curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "black forest gateau cake spelling out the words \"FLUX SCHNELL\", tasty, food photography, dynamic shot"}'
响应
成功响应:
{
"success": true,
"data": {
// Replicate API 返回的数据
}
}
错误响应:
{
"success": false,
"error": "错误信息"
}
关闭服务器
按 Ctrl+C 可以优雅地关闭服务器。
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.
