Skip to main content
openai/gpt-4o에 대한 API 레퍼런스로, Comfy Router가 OpenAI로부터 제공합니다.

빠른 시작

Comfy 워크스페이스에서 키를 생성하고 COMFY_API_KEY로 내보내세요. Python과 TypeScript 스니펫은 Comfy SDK(pip install comfy-sdk, npm install @comfyorg/sdk)를 사용하며, cURL 스니펫은 동일한 호출을 raw HTTP로 수행한 것입니다. 모델 ID: openai/gpt-4o 엔드포인트: POST https://api.comfy.org/v2/models/openai/gpt-4o

Schema

Input

string[]
Additional output data to include in the model response.
string | object[]
필수
Text, image or file inputs to the model, used to generate a response. The one field of this contract Router cannot supply, and the only entry in required below.
string
Inserts a system (or developer) message as the first item in the model’s context.
integer
An upper bound for the number of tokens generated for a response, including visible output tokens and reasoning tokens. On a reasoning id this ceiling is shared with the hidden reasoning tokens, so a small value can consume the whole budget before any visible text — which is why the reasoning smoke cases send 1024 where the chat ones send 16.Range: 1 to
string
OpenAI model identifier. On Comfy Router this field is OPTIONAL and Router fills it from the {model} path segment; an explicit null is replaced the same way. Sending a value that disagrees with the path is refused.
boolean
Whether to allow the model to run tool calls in parallel.
string
The ID of a previous response, for multi-turn conversations.
object
REASONING TIER ONLY. Configuration for reasoning models, e.g. {"effort": "medium"}. Forwarded unchanged; see OpenAI’s reasoning guide for the accepted keys. A chat-tier id ignores it.
boolean
Whether OpenAI stores the generated response for later retrieval.
boolean
Declared so a caller who sends it is not refused, but INERT on this surface: Router SETTLES it to false before dispatch, because it captures the provider response rather than relaying a text/event-stream — which openAiResponsesProxy’s ModifyResponse cannot decode, so a streamed generation would be billed by OpenAI and metered by nobody. Use POST /proxy/openai/v1/responses if you need the stream.
number
Sampling temperature. CHAT TIER ONLY: the o-series reasoning ids (o1, o1-pro, o3, o4-mini) reject this parameter at OpenAI. Router does not refuse it for them — see this component’s note on why the two tiers share one schema — so a reasoning call that sends it is answered by OpenAI’s own error.Range: 0 to 2
object
Output-format configuration, e.g. {"format": {"type": "json_schema", ...}} for Structured Outputs. Forwarded unchanged.
string | object
How the model should select which tool to use. Either a string mode or an object naming a tool.
object[]
Tool definitions the model may call. Router does not narrow the tool taxonomy; see OpenAI’s Responses API reference for the accepted shapes.
number
Nucleus-sampling cutoff. CHAT TIER ONLY, on the same terms as temperature.Range: 0 to 1
string
Truncation strategy when the context exceeds the model’s window. The enum IS enforced here, unlike the three vocabularies above, because these two values are the complete set OpenAI documents and it has not grown. An explicit null is still accepted, on the same terms as the fields above it.Possible values: auto, disabled
object
Token-usage envelope. Present on this contract because the v1 operation declares it on the request body; OpenAI populates it on the RESPONSE, so a caller has no reason to send it.
Generated from the schema Router serves at GET /v2/models/openai/gpt-4o/openapi.json, the same document it validates a call against before the request reaches the provider.

Output

string
Inserts a system (or developer) message as the first item in the model’s context.When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
integer
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
string
The model used to generate the response
number
기본값:"1"
Controls randomness in the responseRange: 0 to 2
number
기본값:"1"
Controls diversity of the response via nucleus samplingRange: 0 to 1
string
기본값:"\"disabled\""
The truncation strategy to use for the model response.
  • auto: If the context of this response and previous ones exceeds the model’s context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.
  • disabled (default): If a model response will exceed the context window size for a model, the request will fail with a 400 error. Possible values: auto, disabled
string
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state.
object
o-series models onlyConfiguration options for reasoning models.
string
Controls which reasoning items are rendered back to the model on later turns, e.g. auto, current_turn, or all_turns.
string
기본값:"\"medium\""
o-series models onlyConstrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.Possible values: low, medium, high
string
Deprecated: use summary instead.A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model’s reasoning process. One of auto, concise, or detailed.Possible values: auto, concise, detailed
string
The reasoning mode used for the response.
string
A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model’s reasoning process. One of auto, concise, or detailed.Possible values: auto, concise, detailed
object
object
An object specifying the format that the model must output.Configuring { "type": "json_schema" } enables Structured Outputs, which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.The default format is { "type": "text" } with no additional options.Not recommended for gpt-4o and newer models:Setting to { "type": "json_object" } enables the older JSON mode, which ensures the message the model generates is valid JSON. Using json_schema is preferred for models that support it.
string
Constrains the verbosity of the model’s response. One of low, medium, or high.
`none`, `auto`, `required` | object
How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.
object[]
boolean
Whether the model response runs in the background.
object
Billing information for the response.
string
The party responsible for paying for the response.
number
Unix timestamp (in seconds) of when this Response was completed. Only present when the status is completed.
number
Unix timestamp (in seconds) of when this Response was created.
object
An error object returned when the model fails to generate a Response.
string
필수
The error code for the response.Possible values: server_error, rate_limit_exceeded, invalid_prompt, vector_store_timeout, invalid_image, invalid_image_format, invalid_base64_image, invalid_image_url, image_too_large, image_too_small, image_parse_error, image_content_policy_violation, invalid_image_mode, image_file_too_large, unsupported_image_media_type, empty_image_file, failed_to_download_image, image_file_not_found
string
필수
A human-readable description of the error.
number
Penalizes new tokens based on their existing frequency in the text so far.
string
Unique identifier for this Response.
object
Details about why the response is incomplete.
string
The reason why the response is incomplete.Possible values: max_output_tokens, content_filter
integer
The maximum number of total calls to built-in tools that can be processed in a response.
object
Set of key-value pairs that can be attached to the response.
object
Moderation results for the response input and output, if moderated completions were requested.
string
The object type of this resource - always set to response.Possible values: response
object[]
An array of content items generated by the model.
  • The length and order of items in the output array is dependent on the model’s response.
  • Rather than accessing the first item in the output array and assuming it’s an assistant message with the content generated by the model, you might consider using the output_text property where supported in SDKs.
string
SDK-only convenience property that contains the aggregated text output from all output_text items in the output array, if any are present. Supported in the Python and JavaScript SDKs.
boolean
기본값:"true"
Whether to allow the model to run tool calls in parallel.
number
Penalizes new tokens based on whether they appear in the text so far.
string
Used by OpenAI to cache responses for similar requests to optimize cache hit rates. Replaces the user field.
string
The retention policy for the prompt cache, e.g. in_memory or 24h.
string
A stable identifier used to help detect users of your application that may be violating OpenAI’s usage policies.
string
The processing tier used to serve the request, e.g. auto, default, flex, scale, or priority.
string
The status of the response generation. One of completed, failed, in_progress, cancelled, queued, or incomplete.Possible values: completed, failed, in_progress, cancelled, queued, incomplete
boolean
Whether the response is stored for later retrieval via the API.
object
Token and request usage broken down by built-in tool.
object
Image generation tool token usage.
integer
object
integer
integer
integer
object
integer
integer
integer
Web search tool usage.
integer
integer
The maximum number of most likely tokens to return at each token position, each with an associated log probability.
object
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
integer
필수
The number of input tokens.
object
필수
A detailed breakdown of the input tokens.
integer
The number of input tokens that were written to the cache.
integer
필수
The number of tokens that were retrieved from the cache. More on prompt caching.
integer
필수
The number of output tokens.
object
필수
A detailed breakdown of the output tokens.
integer
필수
The number of reasoning tokens.
integer
필수
The total number of tokens used.
string
Deprecated identifier for the end-user. Replaced by safety_identifier and prompt_cache_key.

예시

입력

출력

배포 전 확인

SDK는 Idempotency-Key를 생성하고 자동 재시도에서 재사용합니다. 수동 재시도 시에는 원래 키를 재사용하세요. Router는 연결을 최대 10분간 유지할 수 있습니다. 요청이 실패하면 Router는 이유를 설명하는 X-Comfy-Error-Type 응답 헤더를 보냅니다. 422는 Router가 프로바이더를 호출하기 전에 입력을 거부했음을 의미합니다. 생성된 에셋은 결과 URL이 만료될 수 있으므로 즉시 다운로드하세요.

헤더

인증, 멱등성, 요청 ID, 오류 분류, 재시도 간격, 지출 한도.

Router API 사용

모델 검색, 유효성 검사 오류, 재시도, 과금.

제한 사항

Router가 현재 지원하지 않는 기능과 대체 방법.