Skip to content

[Bug] API returns incorrect type for created field #1202

@nint8835

Description

@nint8835

Git commit

9565c7f

Operating System & Version

Fedora 43

GGML backends

Vulkan

Command-line arguments used

/usr/local/bin/sd-server
--listen-port 5802
--diffusion-fa
--diffusion-model /models/stable-diffusion/flux-2-klein-4b-BF16.gguf
--vae /models/stable-diffusion/flux-2-klein-vae.safetensors
--llm /models/Qwen3-4B-BF16.gguf
--cfg-scale 1.0
--steps 4

Steps to reproduce

Generate an image. Observe that the created field returned is a string containing an ISO timestamp

What you expected to happen

The created field should be an int containing a Unix timestamp, as documented in the OpenAI docs

What actually happened

The created field is a string containing an ISO timestamp

Logs / error messages / stack trace

No response

Additional context / environment details

Attempting to point LiteLLM at a stable-diffusion.cpp server, and it strictly validates the response coming back. Returning a string rather than the expected int is causing a 500 internal server error from LiteLLM attempting to validate the returned response

litellm-1  | 01:11:04 - LiteLLM Proxy:ERROR: endpoints.py:175 - litellm.proxy.proxy_server.image_generation(): Exception occured - litellm.APIConnectionError: APIConnectionError: OpenAIException - Invalid response object Traceback (most recent call last):
litellm-1  |   File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py", line 695, in convert_to_model_response_object
litellm-1  |     return LiteLLMResponseObjectHandler.convert_to_image_response(
litellm-1  |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
litellm-1  |         response_object=response_object,
litellm-1  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm-1  |         model_response_object=model_response_object,
litellm-1  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm-1  |         hidden_params=hidden_params,
litellm-1  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm-1  |     )
litellm-1  |     ^
litellm-1  |   File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py", line 314, in convert_to_image_response
litellm-1  |     model_response_object = ImageResponse(**model_response_dict)
litellm-1  |   File "/usr/lib/python3.13/site-packages/litellm/types/utils.py", line 2170, in __init__
litellm-1  |     super().__init__(created=created, data=_data, usage=_usage)  # type: ignore
litellm-1  |     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm-1  |   File "/usr/lib/python3.13/site-packages/pydantic/main.py", line 250, in __init__
litellm-1  |     validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
litellm-1  | pydantic_core._pydantic_core.ValidationError: 1 validation error for ImageResponse
litellm-1  | created
litellm-1  |   Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='2026-01-18T01:10:17Z', input_type=str]
litellm-1  |     For further information visit https://errors.pydantic.dev/2.12/v/int_parsing

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions