Skip to content

Commit e90100e

Browse files
committed
Add.
1 parent 1c1ef2d commit e90100e

File tree

5 files changed

+29
-16
lines changed

5 files changed

+29
-16
lines changed

comfy_api_nodes/apis/PixverseController.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
2-
# filename: https://stagingapi.comfy.org/openapi
3-
# timestamp: 2025-04-22T08:58:11+00:00
2+
# filename: http://localhost:8080/openapi
3+
# timestamp: 2025-04-22T09:45:21+00:00
44

55
from __future__ import annotations
66

comfy_api_nodes/apis/PixverseDto.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
2-
# filename: https://stagingapi.comfy.org/openapi
3-
# timestamp: 2025-04-22T08:58:11+00:00
2+
# filename: http://localhost:8080/openapi
3+
# timestamp: 2025-04-22T09:45:21+00:00
44

55
from __future__ import annotations
66

comfy_api_nodes/apis/__init__.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
2-
# filename: https://stagingapi.comfy.org/openapi
3-
# timestamp: 2025-04-22T08:58:11+00:00
2+
# filename: http://localhost:8080/openapi
3+
# timestamp: 2025-04-22T09:45:21+00:00
44

55
from __future__ import annotations
66

@@ -1139,6 +1139,15 @@ class OpenAIImageGenerationRequest(BaseModel):
11391139
)
11401140

11411141

1142+
class Datum1(BaseModel):
1143+
b64_json: Optional[str] = Field(None, description='Base64 encoded image data')
1144+
url: Optional[str] = Field(None, description='URL of the image')
1145+
1146+
1147+
class OpenAIImageGenerationResponse(BaseModel):
1148+
data: Optional[List[Datum1]] = None
1149+
1150+
11421151
class PersonalAccessToken(BaseModel):
11431152
createdAt: Optional[datetime] = Field(
11441153
None, description='[Output Only]The date and time the token was created.'
@@ -1186,7 +1195,7 @@ class RecraftImageGenerationRequest(BaseModel):
11861195
)
11871196

11881197

1189-
class Datum1(BaseModel):
1198+
class Datum2(BaseModel):
11901199
image_id: Optional[str] = Field(
11911200
None, description='Unique identifier for the generated image'
11921201
)
@@ -1198,7 +1207,7 @@ class RecraftImageGenerationResponse(BaseModel):
11981207
..., description='Unix timestamp when the generation was created'
11991208
)
12001209
credits: int = Field(..., description='Number of credits used for the generation')
1201-
data: List[Datum1] = Field(..., description='Array of generated image information')
1210+
data: List[Datum2] = Field(..., description='Array of generated image information')
12021211

12031212

12041213
class StorageFile(BaseModel):

comfy_api_nodes/apis/client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def request(
138138
request_headers = self.get_headers()
139139
if headers:
140140
request_headers.update(headers)
141+
logging.debug(f"[DEBUG] Request Headers: {request_headers}")
141142
try:
142143
response = requests.request(
143144
method=method,
@@ -220,7 +221,7 @@ def __init__(
220221
self,
221222
endpoint: ApiEndpoint[T, R],
222223
request: T,
223-
api_base: str = "https://api.comfy.org",
224+
api_base: str = "https://stagingapi.comfy.org",
224225
auth_token: Optional[str] = None,
225226
timeout: float = 30.0,
226227
verify_ssl: bool = True,

comfy_api_nodes/nodes_api.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
IdeogramGenerateResponse,
88
ImageRequest,
99
OpenAIImageGenerationRequest,
10+
OpenAIImageGenerationResponse
1011
)
1112
from comfy_api_nodes.apis.client import ApiEndpoint, HttpMethod, SynchronousOperation
1213

@@ -214,6 +215,9 @@ def INPUT_TYPES(cls) -> InputTypeDict:
214215
"tooltip": "Optional random seed",
215216
}),
216217
},
218+
"hidden": {
219+
"auth_token": "AUTH_TOKEN_COMFY_ORG"
220+
}
217221
}
218222

219223
RETURN_TYPES = (IO.IMAGE,)
@@ -222,7 +226,7 @@ def INPUT_TYPES(cls) -> InputTypeDict:
222226
DESCRIPTION = cleandoc(__doc__ or "")
223227
API_NODE = True
224228

225-
def api_call(self, prompt, model, n=1, size="1024x1024", seed=0):
229+
def api_call(self, prompt, model, n=1, size="1024x1024", seed=0, auth_token=None):
226230
# Validate size based on model
227231
if model == "dall-e-2":
228232
if size == "auto":
@@ -251,7 +255,7 @@ def api_call(self, prompt, model, n=1, size="1024x1024", seed=0):
251255
path="/proxy/openai/images/generations",
252256
method=HttpMethod.POST,
253257
request_model=OpenAIImageGenerationRequest,
254-
response_model=None
258+
response_model=OpenAIImageGenerationResponse
255259
),
256260
request=OpenAIImageGenerationRequest(
257261
model=model,
@@ -260,20 +264,19 @@ def api_call(self, prompt, model, n=1, size="1024x1024", seed=0):
260264
size=size,
261265
seed=seed if seed != 0 else None
262266
),
267+
auth_token=auth_token
263268
)
264269

265270
response = operation.execute()
266271

267272
# validate raw JSON response
268-
if not isinstance(response, dict) or 'data' not in response:
269-
raise Exception("Invalid response format from OpenAI endpoint")
270273

271-
data = response['data']
274+
data = response.data
272275
if not data or len(data) == 0:
273276
raise Exception("No images returned from OpenAI endpoint")
274277

275278
# Get base64 image data
276-
b64_data = data[0].get('b64_json')
279+
b64_data = data[0].b64_json
277280
if not b64_data:
278281
raise Exception("No image data in OpenAI response")
279282

@@ -292,7 +295,7 @@ def api_call(self, prompt, model, n=1, size="1024x1024", seed=0):
292295
# NOTE: names should be globally unique
293296
NODE_CLASS_MAPPINGS = {
294297
"IdeogramTextToImage": IdeogramTextToImage,
295-
"OpenAIDalleTextToImage": OpenAIDalleTextToImage,
298+
"OpenAIDalleTextToImage": OpenAITextToImage,
296299
}
297300

298301
# A dictionary that contains the friendly/humanly readable titles for the nodes

0 commit comments

Comments
 (0)