Skip to content

Image Generation Guide

The image generation API at KoboiLLM adheres to the OpenAI Images API specification, enabling seamless integration with any OpenAI or LiteLLM SDK. This guide explains endpoint calls, available parameters, multi-language code snippets, response schemas, and cost estimates across all supported image models (OpenAI gpt-image-*, Google Gemini, and Google Imagen).


Table of Contents

  1. Endpoints & Authentication
  2. Available Models
  3. Request Parameters
  4. Generating Images from Text
  5. Editing Existing Images
  6. Response Structure
  7. Pricing & Rate Cards
  8. Verifying Billing
  9. Error Handling
  10. Tips & Best Practices

1. Endpoints & Authentication

Base URL:

https://lite.koboillm.com/v1

(The alias https://api.koboillm.com/v1 is also available and identical in behavior).

Primary Endpoints:

MethodPathFunction
POST/v1/images/generationsGenerate new images from text prompts
POST/v1/images/editsEdit / modify existing images

Authentication requires the header Authorization: Bearer sk-xxxxxx. Store your API key securely in an environment variable rather than hardcoding it into source files.

Terminal window
export LITELLM_API_KEY="sk-xxxxxx"

2. Available Models

⚠️ Pricing Disclaimer

Rates listed in this document are sourced from official vendor pricing pages (OpenAI and Google Cloud Vertex AI). Vendors may update rate cards at any time. Always verify live account billing on your dashboard at https://lite.koboillm.com.

2.1 — OpenAI Models

ModelEndpoint NameBilling ModeBest Used For
gpt-image-1-minigpt-image-1-miniper-tokenThumbnails, high-volume generation, prototypes — lowest cost
gpt-image-1.5openai/gpt-image-1.5per-tokenGeneral-purpose, balanced quality & price — recommended default
gpt-image-2openai/gpt-image-2per-tokenLatest flagship, top prompt adherence, complex composition
gpt-image-1openai/gpt-image-1per-tokenLegacy version, same rate tier as gpt-image-1-mini
chatgpt-image-latestopenai/chatgpt-image-latestper-token”ChatGPT-style” reasoning image model — highest tier, ~3× gpt-image-1.5
dall-e-3openai/dall-e-3flat per-imageLegacy DALL·E 3 model
dall-e-2dall-e-2flat per-imageLegacy DALL·E 2 model

2.2 — Google Gemini Models (Token-based)

ModelEndpoint NameBest Used For
gemini-2.5-flash-imagegemini/gemini-2.5-flash-image or vertex_ai/gemini-2.5-flash-imageFast & affordable multimodal image generation — recommended Gemini
gemini-3.1-flash-imagegemini/gemini-3.1-flash-image or vertex_ai/gemini-3.1-flash-imageNano Banana 2 image generation
gemini-3-pro-imagegemini/gemini-3-pro-image or vertex_ai/gemini-3-pro-imageNano Banana Pro, highest fidelity in Gemini family

2.3 — Google Imagen Models (Flat-fee per image)

ModelEndpoint NameFlat Rate per ImageBest Used For
imagen-3.0-fast-generate-001vertex_ai/imagen-3.0-fast-generate-001$0.02Imagen 3.0 speed-optimized
imagen-4.0-fast-generate-001vertex_ai/imagen-4.0-fast-generate-001$0.02Imagen 4.0 speed-optimized
imagen-3.0-generate-001vertex_ai/imagen-3.0-generate-001$0.04Imagen 3.0 standard
imagen-4.0-generate-001vertex_ai/imagen-4.0-generate-001$0.04Imagen 4.0 standard
imagen-4.0-ultra-generate-001vertex_ai/imagen-4.0-ultra-generate-001$0.06Imagen 4.0 ultra — highest visual quality

3. Request Parameters

ParameterTypeAllowed ValuesEffect
modelstringany model IDDetermines pricing tier and backend route
promptstringfree textTokenized as text_input
sizestring1024x1024, 1024x1536, 1536x1024, autoResolution. Influences output token count (and total cost).
qualitystringlow, medium, high, autoInfluences output token count. High quality uses ~15× more tokens than low (OpenAI only).
ninteger1–10Image count. Cost scales linearly with n.
response_formatstringurl (default) or b64_jsonOutput encoding format. Does not affect pricing.

4. Generate Images from Text

4.1 — cURL Example

Terminal window
curl -X POST https://lite.koboillm.com/v1/images/generations \
-H "Authorization: Bearer sk-xxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-1.5",
"prompt": "Majestic dragon soaring over mist-covered mountains at sunset",
"size": "1024x1024",
"quality": "high",
"n": 1
}'

4.2 — Python (OpenAI SDK Example)

from openai import OpenAI
client = OpenAI(
base_url="https://lite.koboillm.com/v1",
api_key="sk-xxxxxx",
)
response = client.images.generate(
model="openai/gpt-image-1.5",
prompt="Majestic dragon soaring over mist-covered mountains at sunset",
size="1024x1024",
quality="high",
n=1,
)
print("Generated URL:", response.data[0].url)

5. Editing Existing Images

Use /v1/images/edits for image-to-image workflows, inpainting, and variations.

Terminal window
curl -X POST https://lite.koboillm.com/v1/images/edits \
-H "Authorization: Bearer sk-xxxxxx" \
-F "model=openai/gpt-image-1.5" \
-F "image=@input.png" \
-F "prompt=Change the sky color to deep purple sunset" \
-F "size=1024x1024" \
-F "quality=high"