Image Generation
Serika.dev provides a powerful Image Generation API compatible with the OpenAI standard. You can generate high-quality images using various models, including NovelAI and TensorArt.
Endpoint
POST https://api.serika.dev/api/openai/v1/images/generations
[!NOTE] For heavy models (like TensorArt), consider using the Jobs API to avoid timeouts.
Quick Start
from openai import OpenAI
client = OpenAI(
base_url="https://api.serika.dev/api/openai/v1",
api_key="your_api_key"
)
response = client.images.generate(
model="novelai/nai-diffusion-3",
prompt="A cute anime girl with pink hair, high quality",
size="1024x1024",
quality="standard",
n=1,
)
image_url = response.data[0].url
print(f"Image URL: {image_url}")
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.serika.dev/api/openai/v1',
apiKey: 'your_api_key',
});
async function main() {
const response = await client.images.generate({
model: "novelai/nai-diffusion-3",
prompt: "A cute anime girl with pink hair, high quality",
n: 1,
size: "1024x1024",
});
console.log(response.data[0].url);
}
main();
curl https://api.serika.dev/api/openai/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"model": "novelai/nai-diffusion-3",
"prompt": "A cute anime girl with pink hair, high quality",
"size": "1024x1024",
"n": 1
}'
Available Models
Advanced Parameters
You can pass additional parameters to fine-tune your generation. In the OpenAI Python client, these can often be passed as extra arguments or via extra_body.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
integer |
1024 |
Width of the image. |
|
integer |
1024 |
Height of the image. |
|
integer |
23 |
Number of diffusion steps. |
|
number |
10 |
Guidance scale (CFG). |
|
string |
k_euler_ancestral |
Sampling method. |
|
integer |
random |
Random seed. |
|
string |
- |
Things to exclude from the image. |