> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Comfy Router로 Chat Completions 사용하기

> Comfy Router를 통해 openrouter/chat-completions를 호출합니다: endpoint, 요청 형태, 그리고 Router가 반환하는 응답을 설명합니다.

`openrouter/chat-completions`의 API 레퍼런스입니다. Openrouter에서 Comfy Router를 통해 제공됩니다.

## Request setup

[내 Comfy 워크스페이스](https://platform.comfy.org/profile/api-keys)에서 키를 생성하고 `COMFY_API_KEY`로 내보내기하세요. Python의 경우 `pip install comfy-sdk`를 실행하세요. TypeScript의 경우 `npm install @comfyorg/sdk`를 실행하세요. cURL은 원시 HTTP를 사용합니다.

**Model ID:** `openrouter/chat-completions`

**Endpoint:** `POST https://api.comfy.org/v2/models/openrouter/chat-completions`

<Note>
  이 모델에는 실행 가능한 요청 예제가 없습니다. 아래 입력 문서를 바탕으로 본문을 구성한 뒤, [Router quickstart](/ko/development/comfy-router/quickstart)와 함께 사용하세요.
</Note>

## 스키마

### 입력

<ParamField body="cache_control" type="object">
  자동 프롬프트 캐싱을 활성화합니다. 최상위 수준에서 설정하면 시스템이 요청의 마지막 캐시 가능 블록에 캐시 중단점을 자동으로 적용합니다. 현재 Anthropic Claude 모델에서 지원됩니다.
</ParamField>

<ParamField body="cache_control.ttl" type="string">
  가능한 값: `5m`, `1h`
</ParamField>

<ParamField body="cache_control.type" type="string" required>
  가능한 값: `ephemeral`
</ParamField>

<ParamField body="debug" type="object">
  요청 변환을 검사하기 위한 디버그 옵션 (스트리밍 전용)
</ParamField>

<ParamField body="debug.echo_upstream_body" type="boolean">
  참이면, 스트림 시작 시 디버그 청크에 변환된 업스트림 요청 본문을 포함합니다. 스트리밍 모드에서만 작동합니다.
</ParamField>

<ParamField body="frequency_penalty" type="number">
  빈도 패널티 (-2.0 \~ 2.0)

  형식: `double`
</ParamField>

<ParamField body="image_config" type="object | string | number | object[]" />

<ParamField body="logit_bias" type="object">
  토큰 로짓 편향 조정
</ParamField>

<ParamField body="logprobs" type="boolean">
  로그 확률 반환
</ParamField>

<ParamField body="max_completion_tokens" type="integer">
  완성 시 최대 토큰
</ParamField>

<ParamField body="max_tokens" type="integer">
  최대 토큰 (지원 중단됨, max\_completion\_tokens 사용). 참고: 일부 공급자는 최소 16을 강제합니다.
</ParamField>

<ParamField body="messages" type="object[]" required>
  대화의 메시지 목록
</ParamField>

<ParamField body="metadata" type="object">
  추가 객체 정보를 위한 키-값 쌍 (최대 16쌍, 64자 키, 512자 값)
</ParamField>

<ParamField body="modalities" type="`text`, `image`, `audio`[]">
  응답의 출력 모달리티. 지원되는 값은 "text", "image", "audio"입니다.
</ParamField>

<ParamField body="model" type="string">
  완성에 사용할 모델
</ParamField>

<ParamField body="models" type="string[]">
  완성에 사용할 모델
</ParamField>

<ParamField body="parallel_tool_calls" type="boolean">
  도구 사용 중 병렬 함수 호출을 활성화할지 여부. 참인 경우, 모델은 단일 응답에서 여러 도구 호출을 생성할 수 있습니다.
</ParamField>

<ParamField body="plugins" type="object[]">
  이 요청에 대해 활성화하려는 플러그인과 해당 설정.
</ParamField>

<ParamField body="presence_penalty" type="number">
  존재 패널티 (-2.0 \~ 2.0)

  형식: `double`
</ParamField>

<ParamField body="provider" type="object">
  여러 모델 공급자를 사용할 수 있는 경우, 선택적으로 라우팅 기본 설정을 지정합니다.
</ParamField>

<ParamField body="provider.allow_fallbacks" type="boolean">
  백업 공급자가 요청을 처리하도록 허용할지 여부

  * 참: (기본값) 기본 공급자(또는 "order"의 사용자 지정 공급자)를 사용할 수 없는 경우, 차선의 공급자를 사용합니다.
  * 거짓: 기본/사용자 지정 공급자만 사용하고, 사용할 수 없는 경우 업스트림 오류를 반환합니다.
</ParamField>

<ParamField body="provider.data_collection" type="`deny`, `allow`">
  데이터 수집 설정. 사용 가능한 모델 공급자 중 요구 사항을 충족하는 공급자가 없으면 요청에서 오류가 반환됩니다.

  * allow: (기본값) 사용자 데이터를 비일시적으로 저장하고 학습에 사용할 수 있는 공급자를 허용합니다.

  * deny: 사용자 데이터를 수집하지 않는 공급자만 사용합니다.
</ParamField>

<ParamField body="provider.enforce_distillable_text" type="boolean">
  텍스트 증류를 허용하는 모델로만 라우팅을 제한할지 여부. 참인 경우, 작성자가 증류를 허용한 모델만 사용됩니다.
</ParamField>

<ParamField body="provider.ignore" type="`AkashML`, `AI21`, `AionLabs`, `Alibaba`, `Ambient`, `Baidu`, `Amazon Bedrock`, `Amazon Nova`, `Anthropic`, `Arcee AI`, `AtlasCloud`, `Avian`, `Azure`, `BaseTen`, `BytePlus`, `Black Forest Labs`, `Cerebras`, `Chutes`, `Cirrascale`, `Clarifai`, `Cloudflare`, `Cohere`, `Crucible`, `Crusoe`, `DeepInfra`, `DeepSeek`, `DekaLLM`, `Featherless`, `Fireworks`, `Friendli`, `GMICloud`, `Google`, `Google AI Studio`, `Groq`, `Hyperbolic`, `Inception`, `Inceptron`, `InferenceNet`, `Ionstream`, `Infermatic`, `Io Net`, `Inflection`, `Liquid`, `Mara`, `Mancer 2`, `Minimax`, `ModelRun`, `Mistral`, `Modular`, `Moonshot AI`, `Morph`, `NCompass`, `Nebius`, `Nex AGI`, `NextBit`, `Novita`, `Nvidia`, `OpenAI`, `OpenInference`, `Parasail`, `Poolside`, `Perceptron`, `Perplexity`, `Phala`, `Recraft`, `Reka`, `Relace`, `SambaNova`, `Seed`, `SiliconFlow`, `Sourceful`, `StepFun`, `Stealth`, `StreamLake`, `Switchpoint`, `Together`, `Upstage`, `Venice`, `WandB`, `Xiaomi`, `xAI`, `Z.AI`, `FakeProvider` | string[]">
  무시할 공급자 슬러그 목록. 제공된 경우, 이 목록은 이 요청에 대한 계정 전체의 무시된 공급자 설정과 병합됩니다.
</ParamField>

<ParamField body="provider.max_price" type="object">
  이 요청에 대해 지불할 최대 가격을 지정하는 객체. 프롬프트 및 완성에 대한 백만 토큰당 USD 가격.
</ParamField>

<ParamField body="provider.max_price.audio" type="string">
  백만 프롬프트 토큰당 가격
</ParamField>

<ParamField body="provider.max_price.completion" type="string">
  백만 프롬프트 토큰당 가격
</ParamField>

<ParamField body="provider.max_price.image" type="string">
  백만 프롬프트 토큰당 가격
</ParamField>

<ParamField body="provider.max_price.prompt" type="string">
  백만 프롬프트 토큰당 가격
</ParamField>

<ParamField body="provider.max_price.request" type="string">
  백만 프롬프트 토큰당 가격
</ParamField>

<ParamField body="provider.only" type="`AkashML`, `AI21`, `AionLabs`, `Alibaba`, `Ambient`, `Baidu`, `Amazon Bedrock`, `Amazon Nova`, `Anthropic`, `Arcee AI`, `AtlasCloud`, `Avian`, `Azure`, `BaseTen`, `BytePlus`, `Black Forest Labs`, `Cerebras`, `Chutes`, `Cirrascale`, `Clarifai`, `Cloudflare`, `Cohere`, `Crucible`, `Crusoe`, `DeepInfra`, `DeepSeek`, `DekaLLM`, `Featherless`, `Fireworks`, `Friendli`, `GMICloud`, `Google`, `Google AI Studio`, `Groq`, `Hyperbolic`, `Inception`, `Inceptron`, `InferenceNet`, `Ionstream`, `Infermatic`, `Io Net`, `Inflection`, `Liquid`, `Mara`, `Mancer 2`, `Minimax`, `ModelRun`, `Mistral`, `Modular`, `Moonshot AI`, `Morph`, `NCompass`, `Nebius`, `Nex AGI`, `NextBit`, `Novita`, `Nvidia`, `OpenAI`, `OpenInference`, `Parasail`, `Poolside`, `Perceptron`, `Perplexity`, `Phala`, `Recraft`, `Reka`, `Relace`, `SambaNova`, `Seed`, `SiliconFlow`, `Sourceful`, `StepFun`, `Stealth`, `StreamLake`, `Switchpoint`, `Together`, `Upstage`, `Venice`, `WandB`, `Xiaomi`, `xAI`, `Z.AI`, `FakeProvider` | string[]">
  허용할 공급자 slug 목록입니다. 제공된 경우, 이 목록은 이 요청에 대해 계정 전체에 설정된 허용 공급자 설정과 병합됩니다.
</ParamField>

<ParamField body="provider.order" type="`AkashML`, `AI21`, `AionLabs`, `Alibaba`, `Ambient`, `Baidu`, `Amazon Bedrock`, `Amazon Nova`, `Anthropic`, `Arcee AI`, `AtlasCloud`, `Avian`, `Azure`, `BaseTen`, `BytePlus`, `Black Forest Labs`, `Cerebras`, `Chutes`, `Cirrascale`, `Clarifai`, `Cloudflare`, `Cohere`, `Crucible`, `Crusoe`, `DeepInfra`, `DeepSeek`, `DekaLLM`, `Featherless`, `Fireworks`, `Friendli`, `GMICloud`, `Google`, `Google AI Studio`, `Groq`, `Hyperbolic`, `Inception`, `Inceptron`, `InferenceNet`, `Ionstream`, `Infermatic`, `Io Net`, `Inflection`, `Liquid`, `Mara`, `Mancer 2`, `Minimax`, `ModelRun`, `Mistral`, `Modular`, `Moonshot AI`, `Morph`, `NCompass`, `Nebius`, `Nex AGI`, `NextBit`, `Novita`, `Nvidia`, `OpenAI`, `OpenInference`, `Parasail`, `Poolside`, `Perceptron`, `Perplexity`, `Phala`, `Recraft`, `Reka`, `Relace`, `SambaNova`, `Seed`, `SiliconFlow`, `Sourceful`, `StepFun`, `Stealth`, `StreamLake`, `Switchpoint`, `Together`, `Upstage`, `Venice`, `WandB`, `Xiaomi`, `xAI`, `Z.AI`, `FakeProvider` | string[]">
  순서가 지정된 공급자 slug 목록입니다. 라우터는 요청한 모델을 지원하는 이 목록의 부분집합에서 첫 번째 공급자를 사용하려고 시도하고, 사용할 수 없으면 다음 공급자로 폴백합니다. 사용 가능한 공급자가 없으면 요청은 오류 메시지와 함께 실패합니다.
</ParamField>

<ParamField body="provider.preferred_max_latency" type="number | object">
  선호하는 최대 지연 시간(초)입니다. 숫자(p50에 적용) 또는 백분위수별 임계값을 지정한 객체일 수 있습니다. 임계값을 초과하는 엔드포인트는 여전히 사용될 수 있지만 라우팅에서 우선순위가 낮아집니다. 폴백 모델을 사용하는 경우, 폴백 모델이 임계값을 충족하면 기본 모델 대신 사용될 수 있습니다.
</ParamField>

<ParamField body="provider.preferred_min_throughput" type="number | object">
  선호하는 최소 처리량(초당 토큰)입니다. 숫자(p50에 적용) 또는 백분위수별 임계값을 지정한 객체일 수 있습니다. 임계값 미만인 엔드포인트는 여전히 사용될 수 있지만 라우팅에서 우선순위가 낮아집니다. 폴백 모델을 사용하는 경우, 폴백 모델이 임계값을 충족하면 기본 모델 대신 사용될 수 있습니다.
</ParamField>

<ParamField body="provider.quantizations" type="`int4`, `int8`, `fp4`, `fp6`, `fp8`, `fp16`, `bf16`, `fp32`, `unknown`[]">
  공급자를 필터링할 양자화 수준 목록입니다.
</ParamField>

<ParamField body="provider.require_parameters" type="boolean">
  제공한 파라미터를 지원하는 공급자만 필터링할지 여부입니다. 이 설정을 생략하거나 거짓으로 설정하면, 공급자는 지원하는 파라미터만 전달받고 나머지는 무시합니다.
</ParamField>

<ParamField body="provider.sort" type="`price`, `throughput`, `latency`, `exacto` | object">
  "order"가 지정되지 않은 경우 이 요청에 사용할 정렬 전략입니다. 설정하면 로드 밸런싱이 수행되지 않습니다.
</ParamField>

<ParamField body="provider.zdr" type="boolean">
  라우팅을 ZDR(Zero Data Retention) 엔드포인트로만 제한할지 여부입니다. 참이면 프롬프트를 보존하지 않는 엔드포인트만 사용됩니다.
</ParamField>

<ParamField body="reasoning" type="object">
  추론 모델을 위한 구성 옵션
</ParamField>

<ParamField body="reasoning.effort" type="`xhigh`, `high`, `medium`, `low`, `minimal`, `none`">
  추론 모델의 추론 노력 정도를 제한합니다
</ParamField>

<ParamField body="reasoning.summary" type="string">
  가능한 값: `auto`, `concise`, `detailed`
</ParamField>

<ParamField body="response_format" type="object">
  응답 형식 구성
</ParamField>

<ParamField body="route" type="object">
  모든 타입
</ParamField>

<ParamField body="seed" type="integer">
  결정적 출력을 위한 시드
</ParamField>

<ParamField body="service_tier" type="`auto`, `default`, `flex`, `priority`, `scale`">
  이 요청을 처리하는 데 사용할 서비스 계층입니다.
</ParamField>

<ParamField body="session_id" type="string">
  관찰 가능성을 위해 관련 요청(예: 대화 또는 에이전트 워크플로)을 그룹화하기 위한 고유 식별자입니다. 요청 본문과 x-session-id 헤더 모두에 제공된 경우 본문의 값이 우선합니다. 최대 256자입니다.
</ParamField>

<ParamField body="stop" type="string | string[] | object">
  중지 시퀀스(최대 4개)
</ParamField>

<ParamField body="stop_server_tools_when" type="object[]">
  서버 도구 에이전트 루프의 중지 조건입니다. 조건이 하나라도 충족되면 루프가 중단됩니다(OR 로직). 설정하면 `max_tool_calls`를 재정의합니다.
</ParamField>

<ParamField body="stream" type="boolean" default="false">
  스트리밍 응답 사용
</ParamField>

<ParamField body="stream_options" type="object">
  스트리밍 구성 옵션
</ParamField>

<ParamField body="stream_options.include_usage" type="boolean">
  지원 중단됨: 이 필드는 아무런 효과가 없습니다. 전체 사용 세부 정보는 항상 포함됩니다.
</ParamField>

<ParamField body="temperature" type="number">
  샘플링 temperature (0-2)

  형식: `double`
</ParamField>

<ParamField body="tool_choice" type="`none` | `auto` | `required` | object">
  도구 선택 구성
</ParamField>

<ParamField body="tools" type="object[]">
  함수 호출에 사용할 수 있는 도구
</ParamField>

<ParamField body="top_logprobs" type="integer">
  반환할 상위 로그 확률 개수 (0-20)
</ParamField>

<ParamField body="top_p" type="number">
  누클리어스 샘플링 파라미터 (0-1)

  형식: `double`
</ParamField>

<ParamField body="trace" type="object">
  관측성 및 추적을 위한 메타데이터입니다. 알려진 키(trace\_id, trace\_name, span\_name, generation\_name, parent\_span\_id)는 특별하게 처리됩니다. 추가 키는 구성된 브로드캐스트 대상에 사용자 지정 메타데이터로 전달됩니다.
</ParamField>

<ParamField body="trace.generation_name" type="string" />

<ParamField body="trace.parent_span_id" type="string" />

<ParamField body="trace.span_name" type="string" />

<ParamField body="trace.trace_id" type="string" />

<ParamField body="trace.trace_name" type="string" />

<ParamField body="user" type="string">
  고유 사용자 식별자
</ParamField>

Router가 `GET /v2/models/openrouter/chat-completions/openapi.json`에서 제공하는 스키마에서 생성됨. 이는 요청이 공급자에게 도달하기 이전에 호출을 검증하는 데 사용하는 것과 동일한 문서입니다.

### 출력

<ResponseField name="choices" type="object[]" required>
  완성 선택지 목록
</ResponseField>

<ResponseField name="choices[].finish_reason" type="string" required>
  가능한 값: `tool_calls`, `stop`, `length`, `content_filter`, `error`
</ResponseField>

<ResponseField name="choices[].index" type="integer" required>
  선택지 인덱스
</ResponseField>

<ResponseField name="choices[].logprobs" type="object">
  완성에 대한 로그 확률
</ResponseField>

<ResponseField name="choices[].logprobs.content" type="object[]" required>
  콘텐츠 토큰에 대한 로그 확률
</ResponseField>

<ResponseField name="choices[].logprobs.content[].bytes" type="integer[]" required>
  토큰의 UTF-8 바이트
</ResponseField>

<ResponseField name="choices[].logprobs.content[].logprob" type="number" required>
  토큰의 로그 확률

  형식: `double`
</ResponseField>

<ResponseField name="choices[].logprobs.content[].token" type="string" required>
  토큰
</ResponseField>

<ResponseField name="choices[].logprobs.content[].top_logprobs" type="object[]" required>
  확률이 포함된 상위 대체 토큰
</ResponseField>

<ResponseField name="choices[].logprobs.content[].top_logprobs[].bytes" type="integer[]" required />

<ResponseField name="choices[].logprobs.content[].top_logprobs[].logprob" type="number" required>
  형식: `double`
</ResponseField>

<ResponseField name="choices[].logprobs.content[].top_logprobs[].token" type="string" required />

<ResponseField name="choices[].logprobs.refusal" type="object[]">
  거부 토큰에 대한 로그 확률
</ResponseField>

<ResponseField name="choices[].logprobs.refusal[].bytes" type="integer[]" required>
  토큰의 UTF-8 바이트
</ResponseField>

<ResponseField name="choices[].logprobs.refusal[].logprob" type="number" required>
  토큰의 로그 확률

  형식: `double`
</ResponseField>

<ResponseField name="choices[].logprobs.refusal[].token" type="string" required>
  토큰
</ResponseField>

<ResponseField name="choices[].logprobs.refusal[].top_logprobs" type="object[]" required>
  확률이 포함된 상위 대체 토큰
</ResponseField>

<ResponseField name="choices[].logprobs.refusal[].top_logprobs[].bytes" type="integer[]" required />

<ResponseField name="choices[].logprobs.refusal[].top_logprobs[].logprob" type="number" required>
  형식: `double`
</ResponseField>

<ResponseField name="choices[].logprobs.refusal[].top_logprobs[].token" type="string" required />

<ResponseField name="choices[].message" type="object" required>
  요청 및 응답에 대한 어시스턴트 메시지
</ResponseField>

<ResponseField name="choices[].message.audio" type="object">
  오디오 출력 데이터 또는 참조
</ResponseField>

<ResponseField name="choices[].message.audio.data" type="string">
  Base64로 인코딩된 오디오 데이터
</ResponseField>

<ResponseField name="choices[].message.audio.expires_at" type="integer">
  오디오 만료 타임스탬프
</ResponseField>

<ResponseField name="choices[].message.audio.id" type="string">
  오디오 출력 식별자
</ResponseField>

<ResponseField name="choices[].message.audio.transcript" type="string">
  오디오 전사
</ResponseField>

<ResponseField name="choices[].message.content" type="string | object[] | object">
  어시스턴트 메시지 콘텐츠
</ResponseField>

<ResponseField name="choices[].message.images" type="object[]">
  이미지 생성 모델에서 생성된 이미지
</ResponseField>

<ResponseField name="choices[].message.images[].image_url" type="object" required />

<ResponseField name="choices[].message.images[].image_url.url" type="string" required>
  생성된 이미지의 URL 또는 base64로 인코딩된 데이터
</ResponseField>

<ResponseField name="choices[].message.name" type="string">
  어시스턴트의 선택적 이름
</ResponseField>

<ResponseField name="choices[].message.reasoning" type="string">
  추론 출력
</ResponseField>

<ResponseField name="choices[].message.reasoning_details" type="object[]">
  확장 사고 모델의 추론 세부 정보
</ResponseField>

<ResponseField name="choices[].message.refusal" type="string">
  콘텐츠가 거부된 경우의 거부 메시지
</ResponseField>

<ResponseField name="choices[].message.tool_calls" type="object[]">
  어시스턴트가 수행한 도구 호출
</ResponseField>

<ResponseField name="choices[].message.tool_calls[].function" type="object" required />

<ResponseField name="choices[].message.tool_calls[].function.arguments" type="string" required>
  JSON 문자열 형식의 함수 인자
</ResponseField>

<ResponseField name="choices[].message.tool_calls[].function.name" type="string" required>
  호출할 함수 이름
</ResponseField>

<ResponseField name="choices[].message.tool_calls[].id" type="string" required>
  도구 호출 식별자
</ResponseField>

<ResponseField name="choices[].message.tool_calls[].type" type="string" required>
  가능한 값: `function`
</ResponseField>

<ResponseField name="created" type="integer" required>
  생성 Unix 타임스탬프
</ResponseField>

<ResponseField name="id" type="string" required>
  고유한 완성 식별자
</ResponseField>

<ResponseField name="model" type="string" required>
  완성에 사용된 모델
</ResponseField>

<ResponseField name="object" type="string" required>
  가능한 값: `chat.completion`
</ResponseField>

<ResponseField name="openrouter_metadata" type="object" />

<ResponseField name="openrouter_metadata.attempt" type="integer" required />

<ResponseField name="openrouter_metadata.attempts" type="object[]" />

<ResponseField name="openrouter_metadata.attempts[].model" type="string" required />

<ResponseField name="openrouter_metadata.attempts[].provider" type="string" required />

<ResponseField name="openrouter_metadata.attempts[].status" type="integer" required />

<ResponseField name="openrouter_metadata.endpoints" type="object" required />

<ResponseField name="openrouter_metadata.endpoints.available" type="object[]" required />

<ResponseField name="openrouter_metadata.endpoints.available[].model" type="string" required />

<ResponseField name="openrouter_metadata.endpoints.available[].provider" type="string" required />

<ResponseField name="openrouter_metadata.endpoints.available[].selected" type="boolean" required />

<ResponseField name="openrouter_metadata.endpoints.total" type="integer" required />

<ResponseField name="openrouter_metadata.is_byok" type="boolean" required />

<ResponseField name="openrouter_metadata.params" type="object" />

<ResponseField name="openrouter_metadata.params.quality_floor" type="number">
  형식: `double`
</ResponseField>

<ResponseField name="openrouter_metadata.params.throughput_floor" type="number">
  형식: `double`
</ResponseField>

<ResponseField name="openrouter_metadata.params.version_group" type="string" />

<ResponseField name="openrouter_metadata.pipeline" type="object[]" />

<ResponseField name="openrouter_metadata.pipeline[].cost_usd" type="number">
  형식: `double`
</ResponseField>

<ResponseField name="openrouter_metadata.pipeline[].data" type="object" />

<ResponseField name="openrouter_metadata.pipeline[].guardrail_id" type="string" />

<ResponseField name="openrouter_metadata.pipeline[].guardrail_scope" type="string" />

<ResponseField name="openrouter_metadata.pipeline[].name" type="string" required />

<ResponseField name="openrouter_metadata.pipeline[].summary" type="string" />

<ResponseField name="openrouter_metadata.pipeline[].type" type="string" required>
  pipeline 단계의 범주형 종류입니다. 여러 plugin이 하나의 type을 공유할 수 있습니다(예: 모든 guardrail 수준 plugin이 `guardrail`을 출력). `name` 필드가 어떤 plugin이 출력했는지 구분합니다.

  가능한 값: `guardrail`, `plugin`, `server_tools`, `response_healing`, `context_compression`
</ResponseField>

<ResponseField name="openrouter_metadata.region" type="string" required />

<ResponseField name="openrouter_metadata.requested" type="string" required />

<ResponseField name="openrouter_metadata.strategy" type="string" required>
  가능한 값: `direct`, `auto`, `free`, `latest`, `alias`, `fallback`, `pareto`, `bodybuilder`, `fusion`
</ResponseField>

<ResponseField name="openrouter_metadata.summary" type="string" required />

<ResponseField name="service_tier" type="string">
  이 요청에 대해 업스트림 공급자가 사용한 서비스 등급
</ResponseField>

<ResponseField name="system_fingerprint" type="string" required>
  시스템 지문
</ResponseField>

<ResponseField name="usage" type="object">
  토큰 사용 통계
</ResponseField>

<ResponseField name="usage.completion_tokens" type="integer" required>
  완성(completion)의 토큰 수
</ResponseField>

<ResponseField name="usage.completion_tokens_details" type="object">
  상세 완성 토큰 사용량
</ResponseField>

<ResponseField name="usage.cost" type="number">
  완성(completion) 비용

  형식: `double`
</ResponseField>

<ResponseField name="usage.cost_details" type="object">
  업스트림 추론 비용의 세부 내역
</ResponseField>

<ResponseField name="usage.cost_details.upstream_inference_completions_cost" type="number" required>
  형식: `double`
</ResponseField>

<ResponseField name="usage.cost_details.upstream_inference_cost" type="number">
  형식: `double`
</ResponseField>

<ResponseField name="usage.cost_details.upstream_inference_prompt_cost" type="number" required>
  형식: `double`
</ResponseField>

<ResponseField name="usage.is_byok" type="boolean">
  Bring Your Own Key 구성으로 요청이 이루어졌는지 여부
</ResponseField>

<ResponseField name="usage.prompt_tokens" type="integer" required>
  프롬프트의 토큰 수
</ResponseField>

<ResponseField name="usage.prompt_tokens_details" type="object">
  상세 프롬프트 토큰 사용량
</ResponseField>

<ResponseField name="usage.total_tokens" type="integer" required>
  총 토큰 수
</ResponseField>

## 예시

### 출력

```json theme={null}
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {}
    }
  ],
  "created": 1750000000,
  "id": "gen-0000000000-examplecompletion",
  "model": "anthropic/claude-sonnet-4.5",
  "object": "chat.completion",
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 128,
    "cost": 0.00123,
    "prompt_tokens": 42,
    "total_tokens": 170
  }
}
```

## 배포 전 확인

SDK는 `Idempotency-Key`를 생성하고 자동 재시도에 재사용합니다. 수동으로 재시도할 때는 원본 키를 재사용하세요. Router는 연결을 최대 10분간 유지할 수 있습니다.

요청이 실패하면 Router는 그 이유를 설명하는 `X-Comfy-Error-Type` 응답 헤더를 보냅니다. `422`는 Router가 공급자를 호출하기 전에 입력을 거부했음을 의미하고, `413`은 요청 본문이 Router가 허용하는 크기보다 컸음을 의미합니다. [결과 URL이 만료](/ko/development/comfy-router/reference#결과-에셋)될 수 있으므로 생성된 에셋은 즉시 다운로드하세요.

위의 필드 설명에 명시된 크기 제한은 해당 필드에 대한 공급자 자체의 한도이며, 공급자 사양에서 인용한 것입니다. Router는 전체 요청 본문에 별도의 상한을 적용하며, base64로 인코딩된 미디어도 여기에 포함됩니다. [요청 본문 크기](/ko/development/comfy-router/limitations)를 참고하세요.

<CardGroup cols={3}>
  <Card title="헤더" icon="list" href="/ko/development/comfy-router/headers">
    인증, 멱등성, 요청 ID, 오류 분류, 재시도 간격, 지출 한도.
  </Card>

  <Card title="Router API 사용" icon="code" href="/ko/development/comfy-router/api">
    모델 검색, 검증 오류, 재시도, 과금.
  </Card>

  <Card title="제한 사항" icon="triangle-exclamation" href="/ko/development/comfy-router/limitations">
    Router가 현재 지원하지 않는 기능과 대신 사용할 방법.
  </Card>
</CardGroup>
