NEBIUS_API_KEY environment variable.
Request:
Response
Response
Save the image once you receive the link. Nebius Token Factory does not store the image from the provided link permanently.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
NEBIUS_API_KEY environment variable.
Request:
from openai import OpenAI
import os
client = OpenAI(
base_url="https://api.tokenfactory.nebius.com/v1",
api_key=os.environ.get("NEBIUS_API_KEY"),
)
completion = client.images.generate(
model="stability-ai/sdxl",
prompt="An elephant in a desert",
response_format="b64_json",
extra_body={
"response_extension": "png",
"width": 512,
"height": 512,
"num_inference_steps": 30,
"seed": -1,
"negative_prompt": "Giraffes, night sky"
}
)
print(completion.to_json())
curl https://api.tokenfactory.nebius.com/v1/images/generations \
-H "Authorization: Bearer $NEBIUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "stability-ai/sdxl",
"prompt": "An elephant in a desert",
"response_format": "b64_json",
"response_extension": "webp",
"width": 512,
"height": 512,
"num_inference_steps": 30,
"seed": -1,
"negative_prompt": "Giraffes, night sky"
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.tokenfactory.nebius.com/v1",
apiKey: process.env.NEBIUS_API_KEY,
});
const response = await client.images.generate({
model: 'black-forest-labs/flux-schnell',
response_format: 'b64_json',
width: 1024,
height: 768,
response_extension: 'png',
num_inference_steps: 4,
negative_prompt:
'Giraffes, night sky',
seed: -1,
prompt: 'An elephant in a desert',
}).then((completion) => {
console.log(completion.data);
});
Response
{
"data": [
{
"b64_json": "UklGRg66Ag..."
}
],
"id": "text2img-0941c39c-..."
}
{
"data": [
{
"url": "https://pictures-storage-dev.storage.eu-north1.nebius.cloud/text2img-0941c39c-....webp"
}
],
"id": "text2img-0941c39c-..."
}
Was this page helpful?