Overview
Custom model training lets you fine-tune an Ideogram model on your own dataset of images
via the API. Once training completes, you can generate images using your trained model by
passing its custom_model_uri to the Generate endpoint. To train a model in the
Ideogram app instead, see Custom Image Models.
Endpoint reference
The dataset, training, and model endpoints are part of the v1 API. Generating with a trained model uses the v2 API.
| Endpoint | Method | Description |
|---|---|---|
/datasets | GET | List all datasets for the authenticated user |
/datasets | POST | Create a new dataset |
/datasets/{dataset_id} | GET | Get a dataset, including its file count and file list |
/datasets/{dataset_id}/upload_assets | POST | Upload images and captions to a dataset |
/v1/ideogram-v3/train-model | POST | Start training a custom Ideogram 3.0 model from a dataset |
/models | GET | List custom models (owned or shared) |
/models/{model_id} | GET | Get details for a specific model |
/v2/image/generate/ideogram-3-custom-model | POST | Generate images with a custom Ideogram 3.0 model |
/v2/image/generate/ideogram-4-custom-model | POST | Generate images with a custom Ideogram 4.0 model |
Step 1: Create a dataset
import requests
response = requests.post(
"https://api.ideogram.ai/datasets",
headers={"Api-Key": "<apiKey>"},
json={"name": "My Training Dataset"}
)
dataset = response.json()
dataset_id = dataset["dataset_id"]
print(f"Created dataset: {dataset_id}") Step 2: Upload training images
Upload images (JPEG, PNG, WebP), optional .txt caption sidecar files, or ZIP archives
containing both.
sunset.txt captions
sunset.jpg)
import requests
import glob
files = [("files", open(f, "rb")) for f in glob.glob("training_images/*.jpg")]
response = requests.post(
f"https://api.ideogram.ai/datasets/{dataset_id}/upload_assets",
headers={"Api-Key": "<apiKey>"},
files=files
)
result = response.json()
print(f"Uploaded {result['success_count']}/{result['total_count']} images") Step 3: Train the model
Once your dataset has at least 15 images, start training by sending its dataset_id and a name for your model. This endpoint trains a custom Ideogram 3.0 model. Model names must
be 5 to 30 characters long and can use letters, numbers, spaces, and hyphens.
response = requests.post(
"https://api.ideogram.ai/v1/ideogram-v3/train-model",
headers={"Api-Key": "<apiKey>"},
json={"dataset_id": dataset_id, "model_name": "my-custom-model"}
)
training = response.json()
model_id = training["model_id"]
print(f"Training started: {training['training_status']}") Step 4: Check training status
Poll the model details endpoint to check when training completes. The status field
returns one of the values below. Training is done when it reads COMPLETED,
and
ERRORED means training failed.
import time
while True:
response = requests.get(
f"https://api.ideogram.ai/models/{model_id}",
headers={"Api-Key": "<apiKey>"}
)
model = response.json()["model"]
print(f"Status: {model['status']}")
if model["status"] == "COMPLETED" and model["is_available_for_generation"]:
custom_model_uri = model.get("custom_model_uri")
print(f"Model ready! URI: {custom_model_uri}")
break
elif model["status"] == "ERRORED":
print("Training failed.")
break
time.sleep(60) Step 5: Generate with your model
Once training is complete and is_available_for_generation is true, use the custom_model_uri from the model details to generate images.
Generation uses the v2 API. A model trained in step 3 is a custom Ideogram 3.0 model, so
it uses POST /v2/image/generate/ideogram-3-custom-model, which takes a
multipart form. A custom Ideogram 4.0 model uses POST /v2/image/generate/ideogram-4-custom-model, which takes a JSON body.
response = requests.post(
"https://api.ideogram.ai/v2/image/generate/ideogram-3-custom-model",
headers={"Api-Key": "<apiKey>"},
files={
"prompt": (None, "A photo in my custom style"),
"custom_model_uri": (None, custom_model_uri)
}
)
result = response.json()
if response.status_code == 200:
print(result["data"][0]["url"]) Tips for better results
- Use high-quality images that clearly represent the style or subject you want the model to learn.
- Add captions to guide the model on what each image represents. Captions are optional, and they help the model separate what is in each image from the style or subject you are teaching.
- Keep one thing the same in every image, the style, product, or character you are teaching, and vary everything else. For a style, change the subjects and scenes. For a product, change the angles, backgrounds, and lighting. For a character, change the poses, outfits, and settings.
Frequently asked questions
What are Ideogram Custom Models, and how do they work through the API?
custom_model_uri, then pass it to the v2 custom model endpoints for Generate, Remix, and Inpaint.How is custom model training through the Ideogram API billed?
How much does Ideogram custom model training and inference cost?
How many images do I need to train a custom model through the Ideogram API?
What is the step-by-step process to train a custom model through the Ideogram API?
POST /datasets to create a dataset. 2. Send POST /datasets/{dataset_id}/upload_assets to upload images. 3. Send POST /v1/ideogram-v3/train-model with the dataset_id and a model_name to start training. 4. Poll GET /models/{model_id} until the status is COMPLETED. 5. Pass the returned custom_model_uri to POST /v2/image/generate/ideogram-3-custom-model.How long does Ideogram custom model training take?
GET /models/{model_id} until the status is COMPLETED, or ERRORED if training failed. The example on this page checks once a minute.What are the Enterprise options for Ideogram Custom Models?
What are best practices for training a high-quality Ideogram custom model?
Build it yourself, or have us build it.
Create a key yourself and pay only for what you generate.
We train a model on your data and build the workflow with you.