flux Image Generation Model
Other languages can use a curl example with an API interface similar to dall-e-3
curl Example
shell
curl https://api.openai-hk.com/v1/images/generations \
-H 'Authorization: Bearer hk-replace-with-your-key' \
-H "Content-Type: application/json" \
-d '{
"model": "flux",
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024"
}'curl https://api.openai-hk.com/v1/images/generations \
-H 'Authorization: Bearer hk-replace-with-your-key' \
-H "Content-Type: application/json" \
-d '{
"model": "flux",
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024"
}'Online Test
Note 1. Visit https://flux.ddaiai.com (if blocked, try changing the subdomain prefix to suibian)
2. If it is blocked, you can change the address yourself: https://suibian.ddaiai.com — replace suibian with something else, e.g. https://2024.ddaiai.com, all of these work
Setup
Then configure the following fields as shown in the image below:
OpenAI API endpoint: https://api.openai-hk.com
OpenAI API KEY: hk-your-apiKeyThen configure the following fields as shown in the image below:
OpenAI API endpoint: https://api.openai-hk.com
OpenAI API KEY: hk-your-apiKey
Result
Enter your prompt in the input box
flux-kontext
- Attach an image
- Enter a prompt in the input box describing the modifications to make to the image
modelcan beflux-kontext-maxorflux-kontext-pro
shell
curl -X POST "https://api.openai-hk.com/v1/images/edits" \
-H "Authorization: Bearer hk-replace-with-your-key" \
-F "model=flux-kontext-pro" \
-F "image[]=@body-lotion.png" \
-F 'prompt=Generate a photorealistic image of a gift basket on a white background labeled "Relax & Unwind" with a ribbon and handwriting-like font, containing all the items in the reference pictures'curl -X POST "https://api.openai-hk.com/v1/images/edits" \
-H "Authorization: Bearer hk-replace-with-your-key" \
-F "model=flux-kontext-pro" \
-F "image[]=@body-lotion.png" \
-F 'prompt=Generate a photorealistic image of a gift basket on a white background labeled "Relax & Unwind" with a ribbon and handwriting-like font, containing all the items in the reference pictures'Flux Api
- Create a task
- Query task status
Create a Task
shell
curl --request POST \
--url https://api.openai-hk.com/vmodel/generate \
--header 'Authorization: Bearer hk-your-key' \
--header 'Content-Type: application/json' \
--data '{
"model":"flux-schnell",
"input": {
"prompt": "空气",
"num_outputs": 1,
"aspect_ratio": "1:1",
"output_format": "jpg",
"output_quality": 80,
"seed": 1900004
}
}'curl --request POST \
--url https://api.openai-hk.com/vmodel/generate \
--header 'Authorization: Bearer hk-your-key' \
--header 'Content-Type: application/json' \
--data '{
"model":"flux-schnell",
"input": {
"prompt": "空气",
"num_outputs": 1,
"aspect_ratio": "1:1",
"output_format": "jpg",
"output_quality": 80,
"seed": 1900004
}
}'Request body field descriptions
| Field | Type | Description |
|---|---|---|
| model | string | Options: flux flux-schnell flux-dev flux-pro |
| input | object | Parameters for this model |
| input.prompt | string | Prompt text |
| input.num_outputs | number | Number of images to output, 1-4 |
| input.output_quality | number | Output quality, 1-100 |
| input.seed | number | Random seed |
| input.aspect_ratio | string | Aspect ratio: 1:1 3:4 4:3 16:9 9:16 2:3 3:2 |
Response body — returns an id
json
{
"id": "j3thn0r501rme0cm9xq9sy6xkc"
}{
"id": "j3thn0r501rme0cm9xq9sy6xkc"
}Query Task Status
json
{
"id": "j3thn0r501rme0cm9xq9sy6xkc",
"model": "flux-schnell",
"input": {
"aspect_ratio": "1:1",
"num_outputs": 1,
"output_format": "jpg",
"output_quality": 80,
"prompt": "空气",
"seed": 1900004
},
"output": [
"https://file.aigpai.com/xezq/g44ll27rzLKfdSUDv0UKeYcKYkbhNeUC6USpE3uRW0VMWSHoA/out-0.jpg"
],
"status": "succeeded",
"error": null
}{
"id": "j3thn0r501rme0cm9xq9sy6xkc",
"model": "flux-schnell",
"input": {
"aspect_ratio": "1:1",
"num_outputs": 1,
"output_format": "jpg",
"output_quality": 80,
"prompt": "空气",
"seed": 1900004
},
"output": [
"https://file.aigpai.com/xezq/g44ll27rzLKfdSUDv0UKeYcKYkbhNeUC6USpE3uRW0VMWSHoA/out-0.jpg"
],
"status": "succeeded",
"error": null
}Field descriptions
| Field | Type | Description |
|---|---|---|
| id | string | |
| model | string | Options: flux flux-schnell flux-dev flux-pro |
| input | object | Parameters for this model |
| output | []string | Result URL(s) |
| status | string | Status: starting processing succeeded failed |
| error | string | Error message |
OpenAi-HK
