import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.routeway.ai/v1",
api_key=os.getenv("Routeway_API_KEY")
)
response = client.images.generate(
model="flux-1-schnell",
prompt="A beautiful sunset over a mountain lake",
size="1024x1024",
n=1,
quality="standard"
)
print(response.data[0].url)
const axios = require('axios')
const apiKey = 'your_routeway_api_key'
const url = 'https://api.routeway.ai/v1/images/generations'
const data = {
model: 'flux-1-schnell',
prompt: 'A futuristic city with flying cars',
size: '1024x1024',
n: 1
}
const headers = {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
}
axios
.post(url, data, { headers })
.then(response => {
console.log(response.data)
})
.catch(error => {
console.error('Error:', error)
})
curl https://api.routeway.ai/v1/images/generations \
-H "Authorization: Bearer $Routeway_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1-schnell",
"prompt": "A serene garden with cherry blossoms",
"size": "1024x1024",
"n": 1
}'
{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}API Reference
Image Generations
Generate one or more images from a text prompt. Supports both synchronous and asynchronous modes.
POST
/
v1
/
images
/
generations
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.routeway.ai/v1",
api_key=os.getenv("Routeway_API_KEY")
)
response = client.images.generate(
model="flux-1-schnell",
prompt="A beautiful sunset over a mountain lake",
size="1024x1024",
n=1,
quality="standard"
)
print(response.data[0].url)
const axios = require('axios')
const apiKey = 'your_routeway_api_key'
const url = 'https://api.routeway.ai/v1/images/generations'
const data = {
model: 'flux-1-schnell',
prompt: 'A futuristic city with flying cars',
size: '1024x1024',
n: 1
}
const headers = {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
}
axios
.post(url, data, { headers })
.then(response => {
console.log(response.data)
})
.catch(error => {
console.error('Error:', error)
})
curl https://api.routeway.ai/v1/images/generations \
-H "Authorization: Bearer $Routeway_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1-schnell",
"prompt": "A serene garden with cherry blossoms",
"size": "1024x1024",
"n": 1
}'
{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}This API endpoint allows you to generate images from text prompts using various image generation models.
Images stored via URL are only available for 1 hour after generation. Make sure to download and save important images locally.
Create Image Generation
To generate an image, use the following endpoint:POST /v1/images/generations
Request Body
string
required
The image generation model to use (e.g., “flux-1-schnell”)
string
required
The text prompt for image generation
string
Provider-specific quality preset
string
Target image resolution (e.g., “1024x1024”)
integer
Number of images to generate (default: 1)
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.routeway.ai/v1",
api_key=os.getenv("Routeway_API_KEY")
)
response = client.images.generate(
model="flux-1-schnell",
prompt="A beautiful sunset over a mountain lake",
size="1024x1024",
n=1,
quality="standard"
)
print(response.data[0].url)
const axios = require('axios')
const apiKey = 'your_routeway_api_key'
const url = 'https://api.routeway.ai/v1/images/generations'
const data = {
model: 'flux-1-schnell',
prompt: 'A futuristic city with flying cars',
size: '1024x1024',
n: 1
}
const headers = {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
}
axios
.post(url, data, { headers })
.then(response => {
console.log(response.data)
})
.catch(error => {
console.error('Error:', error)
})
curl https://api.routeway.ai/v1/images/generations \
-H "Authorization: Bearer $Routeway_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1-schnell",
"prompt": "A serene garden with cherry blossoms",
"size": "1024x1024",
"n": 1
}'
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
application/json
Image generation model (e.g., flux-1-schnell)
The text prompt for image generation
Provider-specific quality preset
Target image resolution (e.g., 1024x1024)
Number of images to generate
Output format per image
Available options:
url, b64_json Number of diffusion steps
Random seed for reproducibility
Negative prompt for image generation
Guidance scale for image generation
Queue the request and return a task ID instead of waiting for the image result
Was this page helpful?