Skip to content

ImageGenerationModel

Base classes

Name Children Inherits
BaseModelConfig
tokonomics.data_models
Base configuration shared by all model types.

⋔ Inheritance diagram

graph TD
  3809267807["data_models.ImageGenerationModel"]
  823585605["data_models.BaseModelConfig"]
  330168112["schema.Schema"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  823585605 --> 3809267807
  330168112 --> 823585605
  3879467795 --> 330168112
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseModelConfig

Image generation models with per-image pricing.

Source code in src/tokonomics/data_models.py
class ImageGenerationModel(BaseModelConfig):
    """Image generation models with per-image pricing."""

    mode: Literal[ModelMode.IMAGE_GENERATION]
    """Model operation mode."""

    # Token limits (for text prompts)
    max_input_tokens: int | None = Field(None, gt=0)
    """Maximum input tokens."""

    max_output_tokens: int | None = Field(None, gt=0)
    """Maximum output tokens."""

    # Pricing structure
    input_cost_per_token: Decimal | None = Field(None, ge=0)
    """Input cost per token."""

    output_cost_per_token: Decimal | None = Field(None, ge=0)
    """Output cost per token."""

    output_cost_per_image: Decimal | None = Field(None, ge=0)
    """Output cost per generated image."""

    output_cost_per_reasoning_token: Decimal | None = Field(None, ge=0)
    """Output cost per reasoning token."""

    # Cache and multimodal pricing
    cache_read_input_token_cost: Decimal | None = Field(None, ge=0)
    """Cache read input token cost."""

    input_cost_per_audio_token: Decimal | None = Field(None, ge=0)
    """Input cost per audio token."""

    # Pixel-based pricing for image generation
    input_cost_per_pixel: Decimal | None = Field(None, ge=0)
    """Input cost per pixel."""

    output_cost_per_pixel: Decimal | None = Field(None, ge=0)
    """Output cost per pixel."""

    # Alternative image-based pricing
    input_cost_per_image: Decimal | None = Field(None, ge=0)
    """Input cost per image."""

    # Multimodal limits (inherited from chat capabilities)
    max_images_per_prompt: int | None = Field(None, gt=0)
    """Maximum images per prompt."""

    max_videos_per_prompt: int | None = Field(None, gt=0)
    """Maximum videos per prompt."""

    max_video_length: float | None = Field(None, gt=0)
    """Maximum video length."""

    max_audio_per_prompt: int | None = Field(None, gt=0)
    """Maximum audio files per prompt."""

    max_audio_length_hours: float | None = Field(None, gt=0)
    """Maximum audio length in hours."""

    max_pdf_size_mb: float | None = Field(None, gt=0)
    """Maximum PDF size in MB."""

    # Capabilities (subset of chat model capabilities)
    supports_function_calling: bool | None = None
    """Whether model supports function calling."""

    supports_parallel_function_calling: bool | None = None
    """Whether model supports parallel function calling."""

    supports_tool_choice: bool | None = None
    """Whether model supports tool choice."""

    supports_response_schema: bool | None = None
    """Whether model supports response schema."""

    supports_system_messages: bool | None = None
    """Whether model supports system messages."""

    supports_vision: bool | None = None
    """Whether model supports vision/image input."""

    supports_pdf_input: bool | None = None
    """Whether model supports PDF input."""

    supports_prompt_caching: bool | None = None
    """Whether model supports prompt caching."""

    supports_url_context: bool | None = None
    """Whether model supports URL context."""

    supports_web_search: bool | None = None
    """Whether model supports web search."""

    supports_audio_output: bool | None = None
    """Whether model supports audio output."""

    # API support
    supported_endpoints: list[SupportedEndpoint] | None = None
    """List of supported API endpoints."""

    supported_modalities: list[SupportedModality] | None = None
    """List of supported input modalities."""

    supported_output_modalities: list[SupportedOutputModality] | None = None
    """List of supported output modalities."""

cache_read_input_token_cost class-attribute instance-attribute

cache_read_input_token_cost: Decimal | None = Field(None, ge=0)

Cache read input token cost.

input_cost_per_audio_token class-attribute instance-attribute

input_cost_per_audio_token: Decimal | None = Field(None, ge=0)

Input cost per audio token.

input_cost_per_image class-attribute instance-attribute

input_cost_per_image: Decimal | None = Field(None, ge=0)

Input cost per image.

input_cost_per_pixel class-attribute instance-attribute

input_cost_per_pixel: Decimal | None = Field(None, ge=0)

Input cost per pixel.

input_cost_per_token class-attribute instance-attribute

input_cost_per_token: Decimal | None = Field(None, ge=0)

Input cost per token.

max_audio_length_hours class-attribute instance-attribute

max_audio_length_hours: float | None = Field(None, gt=0)

Maximum audio length in hours.

max_audio_per_prompt class-attribute instance-attribute

max_audio_per_prompt: int | None = Field(None, gt=0)

Maximum audio files per prompt.

max_images_per_prompt class-attribute instance-attribute

max_images_per_prompt: int | None = Field(None, gt=0)

Maximum images per prompt.

max_input_tokens class-attribute instance-attribute

max_input_tokens: int | None = Field(None, gt=0)

Maximum input tokens.

max_output_tokens class-attribute instance-attribute

max_output_tokens: int | None = Field(None, gt=0)

Maximum output tokens.

max_pdf_size_mb class-attribute instance-attribute

max_pdf_size_mb: float | None = Field(None, gt=0)

Maximum PDF size in MB.

max_video_length class-attribute instance-attribute

max_video_length: float | None = Field(None, gt=0)

Maximum video length.

max_videos_per_prompt class-attribute instance-attribute

max_videos_per_prompt: int | None = Field(None, gt=0)

Maximum videos per prompt.

mode instance-attribute

mode: Literal[IMAGE_GENERATION]

Model operation mode.

output_cost_per_image class-attribute instance-attribute

output_cost_per_image: Decimal | None = Field(None, ge=0)

Output cost per generated image.

output_cost_per_pixel class-attribute instance-attribute

output_cost_per_pixel: Decimal | None = Field(None, ge=0)

Output cost per pixel.

output_cost_per_reasoning_token class-attribute instance-attribute

output_cost_per_reasoning_token: Decimal | None = Field(None, ge=0)

Output cost per reasoning token.

output_cost_per_token class-attribute instance-attribute

output_cost_per_token: Decimal | None = Field(None, ge=0)

Output cost per token.

supported_endpoints class-attribute instance-attribute

supported_endpoints: list[SupportedEndpoint] | None = None

List of supported API endpoints.

supported_modalities class-attribute instance-attribute

supported_modalities: list[SupportedModality] | None = None

List of supported input modalities.

supported_output_modalities class-attribute instance-attribute

supported_output_modalities: list[SupportedOutputModality] | None = None

List of supported output modalities.

supports_audio_output class-attribute instance-attribute

supports_audio_output: bool | None = None

Whether model supports audio output.

supports_function_calling class-attribute instance-attribute

supports_function_calling: bool | None = None

Whether model supports function calling.

supports_parallel_function_calling class-attribute instance-attribute

supports_parallel_function_calling: bool | None = None

Whether model supports parallel function calling.

supports_pdf_input class-attribute instance-attribute

supports_pdf_input: bool | None = None

Whether model supports PDF input.

supports_prompt_caching class-attribute instance-attribute

supports_prompt_caching: bool | None = None

Whether model supports prompt caching.

supports_response_schema class-attribute instance-attribute

supports_response_schema: bool | None = None

Whether model supports response schema.

supports_system_messages class-attribute instance-attribute

supports_system_messages: bool | None = None

Whether model supports system messages.

supports_tool_choice class-attribute instance-attribute

supports_tool_choice: bool | None = None

Whether model supports tool choice.

supports_url_context class-attribute instance-attribute

supports_url_context: bool | None = None

Whether model supports URL context.

supports_vision class-attribute instance-attribute

supports_vision: bool | None = None

Whether model supports vision/image input.

supports_web_search: bool | None = None

Whether model supports web search.

:fa-brands-github: Show source on GitHub