Endpoints
Генерация изображений
POST https://ask.chadgpt.ru/api/public/{model}/imagine
Запускает генерацию изображения с использованием указанной модели.
Параметры запроса:
Все модели поддерживают базовые параметры:
- api_key (string, обязательный): API ключ для аутентификации
- prompt (string, обязательный): Текстовое описание изображения (1-1000 символов)
Специфичные параметры по моделям:
Imagen модели
{
"api_key": "your-api-key",
"prompt": "A beautiful sunset over mountains",
"aspect_ratio": "1:1"
}
aspect_ratio: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" (по умолчанию: "1:1")
Midjourney модели
{
"api_key": "your-api-key",
"prompt": "A futuristic cityscape",
"aspect_ratio": "1:1",
"chaos": 50,
"quality": "high",
"seed": 12345,
"style": "anime"
}
Дополнительные параметры:
- `aspect_ratio`: `"1:1"` | `"3:2"` | `"2:3"` | `"16:9"` | `"9:16"`
- `chaos` (integer, 0-100): Уровень хаотичности
- `no` (string): Негативные промпты
- `quality` (string): Качество генерации
- `seed` (integer, 0-4000000): Сид для воспроизводимости
- `stop` (integer, 10-100): Процент остановки
- `style` (string): Стиль
- `stylize` (integer, ≥0): Уровень стилизации
- `tile` (boolean): Включить тайлинг
- `weird` (integer, ≥0): Уровень странности
Gemini модели
{
"api_key": "your-api-key",
"prompt": "Describe this image",
"image_urls": ["https://example.com/image.jpg"],
"image_base64s": ["data:image/jpeg;base64,..."]
}
Дополнительные параметры:
- `image_urls` (array, max 5): Список URL изображений
- `image_base64s` (array, max 5): Список base64 изображений
Flux модели
Flux 1 Schnell:
{
"api_key": "your-api-key",
"prompt": "A magical forest",
"aspect_ratio": "1:1",
"images": 1
}
Flux 1.1 Pro Ultra:
{
"api_key": "your-api-key",
"prompt": "A cyberpunk city",
"aspect_ratio": "16:9",
"seed": 12345,
"is_raw": false
}
Flux Kontext модели:
{
"api_key": "your-api-key",
"prompt": "Transform this image",
"aspect_ratio": "1:1",
"seed": 12345,
"image_url": "https://example.com/image.jpg"
}
Stable Diffusion
{
"api_key": "your-api-key",
"prompt": "A steampunk robot",
"aspect_ratio": "1:1",
"images": 1
}
Дополнительные параметры:
- `aspect_ratio`: `"1:1"` | `"9:7"` | `"7:9"` | `"19:13"` | `"7:4"` | `"4:7"` | `"12:5"` | `"5:12"`
- `images`: `1` | `4` (количество изображений)
DALL-E модели
{
"api_key": "your-api-key",
"prompt": "A cute robot",
"aspect_ratio": "1:1"
}
aspect_ratio: `"1:1"` | `"16:9"` | `"9:16"`
Seedream
{
"api_key": "your-api-key",
"prompt": "A fantasy landscape",
"aspect_ratio": "16:9",
"size_preset": "2K",
"image_urls": ["https://example.com/image.jpg"]
}
Дополнительные параметры:
- `aspect_ratio`: `"1:1"` | `"4:3"` | `"3:4"` | `"16:9"` | `"9:16"` | `"3:2"` | `"2:3"` | `"21:9"`
- `size_preset`: `"1K"` | `"2K"` | `"4K"`
- `image_urls` (array, max 5): Список URL изображений
Seededit
{
"api_key": "your-api-key",
"prompt": "Make this image more colorful",
"seed": 12345,
"guidance_scale": 7.5,
"image_url": "https://example.com/image.jpg"
}
Дополнительные параметры:
- `seed` (integer, 0-4000000): Сид для воспроизводимости
- `guidance_scale` (float, 1.0-10.0): Масштаб направленности
- `image_url` (string): URL изображения
- `image_base64` (string): Base64 изображения
Примечание: Необходимо указать либо `image_url`, либо `image_base64`, но не оба одновременно.
Ответ при успехе:
{
"status": "starting",
"content_id": "550e8400-e29b-41d4-a716-446655440000",
"created_at": "2024-01-15T10:30:00Z",
"input": {
"prompt": "A beautiful sunset over mountains",
"aspect_ratio": "1:1",
"img_count": 1
},
"model": "imagen-4"
}
Ответ при ошибке:
{
"status": "failed",
"error_code": "IMG-001",
"error_message": "invalid-api-key"
}