Some checks failed
Build and Push Docker Image / build (push) Failing after 9s
The original implementation used guessed endpoint paths that don't match
the actual Freepik API. Key fixes based on their OpenAPI spec:
- Task polling is per-endpoint (e.g. GET /v1/ai/text-to-image/flux-dev/{task-id})
not a generic /v1/ai/tasks/{id}. freepik_client now returns TaskResult
with status_path, and task_tracker polls using that path.
- Fixed endpoint paths: flux-pro -> flux-pro-v1-1, upscale -> image-upscaler,
relight -> image-relight, style-transfer -> image-style-transfer,
expand -> image-expand/flux-pro, inpaint -> ideogram-image-edit,
remove-background -> beta/remove-background, classifier -> classifier/image,
audio-isolate -> audio-isolation, icon -> text-to-icon
- Fixed video paths: kling -> kling-o1-pro with kling-o1 status path,
minimax -> minimax-hailuo-02-1080p, seedance -> seedance-pro-1080p
- Fixed request schemas to match actual API params (e.g. scale_factor
not scale, reference_image not style_reference, image_url for bg removal)
- Fixed response parsing: status is uppercase (COMPLETED not completed),
results in data.generated[] array, classifier returns [{class_name, probability}]
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
1.5 KiB
Python
35 lines
1.5 KiB
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class MysticRequest(BaseModel):
|
|
prompt: str = Field(..., min_length=1, max_length=4000)
|
|
resolution: Optional[str] = Field(None, description='1k, 2k, or 4k')
|
|
aspect_ratio: Optional[str] = Field(None, description='e.g. square_1_1, widescreen_16_9')
|
|
model: Optional[str] = Field(None, description='realism, fluid, zen, flexible, super_real, editorial_portraits')
|
|
seed: Optional[int] = Field(None, ge=1, le=4294967295)
|
|
styling: Optional[dict] = None
|
|
structure_reference: Optional[str] = Field(None, description='Base64 image for structure reference')
|
|
style_reference: Optional[str] = Field(None, description='Base64 image for style reference')
|
|
|
|
|
|
class FluxDevRequest(BaseModel):
|
|
prompt: str = Field(..., min_length=1, max_length=4000)
|
|
aspect_ratio: Optional[str] = Field(None, description='e.g. square_1_1, widescreen_16_9')
|
|
styling: Optional[dict] = None
|
|
seed: Optional[int] = Field(None, ge=1, le=4294967295)
|
|
|
|
|
|
class FluxProRequest(BaseModel):
|
|
prompt: str = Field(..., min_length=1, max_length=4000)
|
|
aspect_ratio: Optional[str] = Field(None, description='e.g. square_1_1, widescreen_16_9')
|
|
styling: Optional[dict] = None
|
|
seed: Optional[int] = Field(None, ge=1, le=4294967295)
|
|
|
|
|
|
class SeedreamRequest(BaseModel):
|
|
prompt: str = Field(..., min_length=1, max_length=4000)
|
|
aspect_ratio: Optional[str] = Field(None, description='e.g. square_1_1, widescreen_16_9')
|
|
seed: Optional[int] = Field(None, ge=1, le=4294967295)
|