44from .errors import ModelNotFoundError
55from .types import FileInput , MotionTrajectoryInput
66
7-
87RealTimeModels = Literal [
98 # Canonical names
109 "lucy" ,
@@ -89,10 +88,11 @@ class DecartBaseModel(BaseModel):
8988class ModelDefinition (DecartBaseModel , Generic [ModelT ]):
9089 name : ModelT
9190 url_path : str
91+ queue_url_path : Optional [str ] = None
9292 fps : int = Field (ge = 1 )
9393 width : int = Field (ge = 1 )
9494 height : int = Field (ge = 1 )
95- input_schema : type [BaseModel ]
95+ input_schema : type [BaseModel ] = BaseModel
9696
9797
9898# Type aliases for model definitions that support specific APIs
@@ -105,6 +105,13 @@ class ModelDefinition(DecartBaseModel, Generic[ModelT]):
105105RealTimeModelDefinition = ModelDefinition [RealTimeModels ]
106106"""Type alias for model definitions that support realtime streaming."""
107107
108+ CustomModelDefinition = ModelDefinition [str ]
109+ """Type alias for custom model definitions with arbitrary model names.
110+
111+ Useful for preview, experimental, or private models that are not yet
112+ in the SDK's built-in registry.
113+ """
114+
108115
109116class VideoToVideoInput (DecartBaseModel ):
110117 prompt : str = Field (
@@ -299,6 +306,7 @@ class ImageToImageInput(DecartBaseModel):
299306 "lucy-clip" : ModelDefinition (
300307 name = "lucy-clip" ,
301308 url_path = "/v1/jobs/lucy-clip" ,
309+ queue_url_path = "/v1/jobs/lucy-clip" ,
302310 fps = 25 ,
303311 width = 1280 ,
304312 height = 704 ,
@@ -307,6 +315,7 @@ class ImageToImageInput(DecartBaseModel):
307315 "lucy-2.1" : ModelDefinition (
308316 name = "lucy-2.1" ,
309317 url_path = "/v1/jobs/lucy-2.1" ,
318+ queue_url_path = "/v1/jobs/lucy-2.1" ,
310319 fps = 20 ,
311320 width = 1088 ,
312321 height = 624 ,
@@ -315,6 +324,7 @@ class ImageToImageInput(DecartBaseModel):
315324 "lucy-2.1-vton" : ModelDefinition (
316325 name = "lucy-2.1-vton" ,
317326 url_path = "/v1/jobs/lucy-2.1-vton" ,
327+ queue_url_path = "/v1/jobs/lucy-2.1-vton" ,
318328 fps = 20 ,
319329 width = 1088 ,
320330 height = 624 ,
@@ -323,6 +333,7 @@ class ImageToImageInput(DecartBaseModel):
323333 "lucy-restyle-2" : ModelDefinition (
324334 name = "lucy-restyle-2" ,
325335 url_path = "/v1/jobs/lucy-restyle-2" ,
336+ queue_url_path = "/v1/jobs/lucy-restyle-2" ,
326337 fps = 22 ,
327338 width = 1280 ,
328339 height = 704 ,
@@ -331,6 +342,7 @@ class ImageToImageInput(DecartBaseModel):
331342 "lucy-motion" : ModelDefinition (
332343 name = "lucy-motion" ,
333344 url_path = "/v1/jobs/lucy-motion" ,
345+ queue_url_path = "/v1/jobs/lucy-motion" ,
334346 fps = 25 ,
335347 width = 1280 ,
336348 height = 704 ,
@@ -340,6 +352,7 @@ class ImageToImageInput(DecartBaseModel):
340352 "lucy-latest" : ModelDefinition (
341353 name = "lucy-latest" ,
342354 url_path = "/v1/jobs/lucy-latest" ,
355+ queue_url_path = "/v1/jobs/lucy-latest" ,
343356 fps = 20 ,
344357 width = 1088 ,
345358 height = 624 ,
@@ -348,6 +361,7 @@ class ImageToImageInput(DecartBaseModel):
348361 "lucy-vton-latest" : ModelDefinition (
349362 name = "lucy-vton-latest" ,
350363 url_path = "/v1/jobs/lucy-vton-latest" ,
364+ queue_url_path = "/v1/jobs/lucy-vton-latest" ,
351365 fps = 20 ,
352366 width = 1088 ,
353367 height = 624 ,
@@ -356,6 +370,7 @@ class ImageToImageInput(DecartBaseModel):
356370 "lucy-restyle-latest" : ModelDefinition (
357371 name = "lucy-restyle-latest" ,
358372 url_path = "/v1/jobs/lucy-restyle-latest" ,
373+ queue_url_path = "/v1/jobs/lucy-restyle-latest" ,
359374 fps = 22 ,
360375 width = 1280 ,
361376 height = 704 ,
@@ -364,6 +379,7 @@ class ImageToImageInput(DecartBaseModel):
364379 "lucy-clip-latest" : ModelDefinition (
365380 name = "lucy-clip-latest" ,
366381 url_path = "/v1/jobs/lucy-clip-latest" ,
382+ queue_url_path = "/v1/jobs/lucy-clip-latest" ,
367383 fps = 25 ,
368384 width = 1280 ,
369385 height = 704 ,
@@ -372,6 +388,7 @@ class ImageToImageInput(DecartBaseModel):
372388 "lucy-motion-latest" : ModelDefinition (
373389 name = "lucy-motion-latest" ,
374390 url_path = "/v1/jobs/lucy-motion-latest" ,
391+ queue_url_path = "/v1/jobs/lucy-motion-latest" ,
375392 fps = 25 ,
376393 width = 1280 ,
377394 height = 704 ,
@@ -381,6 +398,7 @@ class ImageToImageInput(DecartBaseModel):
381398 "lucy-pro-v2v" : ModelDefinition (
382399 name = "lucy-pro-v2v" ,
383400 url_path = "/v1/jobs/lucy-pro-v2v" ,
401+ queue_url_path = "/v1/jobs/lucy-pro-v2v" ,
384402 fps = 25 ,
385403 width = 1280 ,
386404 height = 704 ,
@@ -389,6 +407,7 @@ class ImageToImageInput(DecartBaseModel):
389407 "lucy-restyle-v2v" : ModelDefinition (
390408 name = "lucy-restyle-v2v" ,
391409 url_path = "/v1/jobs/lucy-restyle-v2v" ,
410+ queue_url_path = "/v1/jobs/lucy-restyle-v2v" ,
392411 fps = 22 ,
393412 width = 1280 ,
394413 height = 704 ,
@@ -428,6 +447,41 @@ class ImageToImageInput(DecartBaseModel):
428447
429448
430449class Models :
450+ @staticmethod
451+ def custom (
452+ name : str ,
453+ * ,
454+ fps : int ,
455+ width : int ,
456+ height : int ,
457+ url_path : str = "/v1/stream" ,
458+ input_schema : type [BaseModel ] = BaseModel ,
459+ queue_url_path : Optional [str ] = None ,
460+ ) -> CustomModelDefinition :
461+ """Create a custom model definition with an arbitrary model name.
462+
463+ This is useful for preview, experimental, or private models that are
464+ not yet in the SDK's built-in registry. Pass the returned definition
465+ directly to the matching client API.
466+
467+ For realtime models, keep the default ``url_path="/v1/stream"``.
468+ For process/custom image models, pass the generation endpoint as
469+ ``url_path``; the default realtime stream path is not valid for
470+ ``client.process()``. For queue/custom video models, pass
471+ ``queue_url_path``.
472+ If ``input_schema`` is omitted, process and queue inputs are sent
473+ through without client-side schema validation.
474+ """
475+ return CustomModelDefinition (
476+ name = name ,
477+ url_path = url_path ,
478+ queue_url_path = queue_url_path ,
479+ fps = fps ,
480+ width = width ,
481+ height = height ,
482+ input_schema = input_schema ,
483+ )
484+
431485 @staticmethod
432486 def realtime (model : RealTimeModels ) -> RealTimeModelDefinition :
433487 """Get a realtime model definition for WebRTC streaming."""
0 commit comments