Skip to content

Commit 6c5f906

Browse files
authored
feat(api-nodes): add Grok Imagine nodes (Comfy-Org#12136)
1 parent 4f5bd39 commit 6c5f906

File tree

2 files changed

+484
-0
lines changed

2 files changed

+484
-0
lines changed

comfy_api_nodes/apis/grok.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
from pydantic import BaseModel, Field
2+
3+
4+
class ImageGenerationRequest(BaseModel):
5+
model: str = Field(...)
6+
prompt: str = Field(...)
7+
aspect_ratio: str = Field(...)
8+
n: int = Field(...)
9+
seed: int = Field(...)
10+
response_for: str = Field("url")
11+
12+
13+
class InputUrlObject(BaseModel):
14+
url: str = Field(...)
15+
16+
17+
class ImageEditRequest(BaseModel):
18+
model: str = Field(...)
19+
image: InputUrlObject = Field(...)
20+
prompt: str = Field(...)
21+
resolution: str = Field(...)
22+
n: int = Field(...)
23+
seed: int = Field(...)
24+
response_for: str = Field("url")
25+
26+
27+
class VideoGenerationRequest(BaseModel):
28+
model: str = Field(...)
29+
prompt: str = Field(...)
30+
image: InputUrlObject | None = Field(...)
31+
duration: int = Field(...)
32+
aspect_ratio: str | None = Field(...)
33+
resolution: str = Field(...)
34+
seed: int = Field(...)
35+
36+
37+
class VideoEditRequest(BaseModel):
38+
model: str = Field(...)
39+
prompt: str = Field(...)
40+
video: InputUrlObject = Field(...)
41+
seed: int = Field(...)
42+
43+
44+
class ImageResponseObject(BaseModel):
45+
url: str | None = Field(None)
46+
b64_json: str | None = Field(None)
47+
revised_prompt: str | None = Field(None)
48+
49+
50+
class ImageGenerationResponse(BaseModel):
51+
data: list[ImageResponseObject] = Field(...)
52+
53+
54+
class VideoGenerationResponse(BaseModel):
55+
request_id: str = Field(...)
56+
57+
58+
class VideoResponseObject(BaseModel):
59+
url: str = Field(...)
60+
upsampled_prompt: str | None = Field(None)
61+
duration: int = Field(...)
62+
63+
64+
class VideoStatusResponse(BaseModel):
65+
status: str | None = Field(None)
66+
video: VideoResponseObject | None = Field(None)
67+
model: str | None = Field(None)

0 commit comments

Comments
 (0)