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

# 애플리케이션 연결하기

> Model Distillation 프록시를 통해 검증된 첫 요청을 보내세요.

대부분의 Chat Completion 애플리케이션은 base URL, API 키, 모델 이름만 새로 지정하면 됩니다. 나머지 요청 및 응답 처리 방식은 그대로 유지됩니다.

<h2 id="before-you-begin">
  시작하기 전에
</h2>

W\&B API 키, 라우팅이 적용된 프로젝트, 해당 프로젝트의 W\&B entity가 필요합니다.

<Tabs>
  <Tab title="Python">
    ```python theme={"system"}
    import os

    from openai import OpenAI

    client = OpenAI(
        base_url="https://proxy.training.wandb.ai/v1",
        api_key=os.environ["WANDB_API_KEY"],
    )

    response = client.chat.completions.create(
        model="ticket-classifier",
        messages=[
            {"role": "user", "content": "My package arrived damaged. What should I do?"}
        ],
        extra_body={
            "metadata": {
                "wandb.entity": "your-team",
                "wandb.thread_id": "customer-4827",
            }
        },
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={"system"}
    import OpenAI from "openai";

    const client = new OpenAI({
      baseURL: "https://proxy.training.wandb.ai/v1",
      apiKey: process.env.WANDB_API_KEY,
    });

    const response = await client.chat.completions.create({
      model: "ticket-classifier",
      messages: [
        { role: "user", content: "My package arrived damaged. What should I do?" },
      ],
      metadata: {
        "wandb.entity": "your-team",
        "wandb.thread_id": "customer-4827",
      },
    });

    console.log(response.choices[0].message.content);
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={"system"}
    curl https://proxy.training.wandb.ai/v1/chat/completions \
      -H "Authorization: Bearer $WANDB_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "ticket-classifier",
        "messages": [
          {"role": "user", "content": "My package arrived damaged. What should I do?"}
        ],
        "metadata": {
          "wandb.entity": "your-team",
          "wandb.thread_id": "customer-4827"
        }
      }'
    ```
  </Tab>
</Tabs>

프로젝트가 API 키의 기본 entity에 속하는 경우에만 `wandb.entity`를 생략하세요.

<h2 id="verify-the-integration">
  인테그레이션 확인
</h2>

요청을 보낸 후 프로젝트 개요로 돌아가 다음을 확인하세요:

* 요청 수가 증가했는지;
* 예상한 모델이 요청을 서빙했는지;
* 저장된 input과 답변이 올바르게 보이는지.

프록시가 개인 entity에 프로젝트가 존재하지 않는다고 말하면 `metadata["wandb.entity"]`에 팀 이름을 추가하세요.

<h2 id="preserve-conversation-identity">
  대화 ID 유지
</h2>

`wandb.thread_id`를 한 대화의 모든 요청에 동일하게 사용하세요. 이렇게 하면 점진적 롤아웃 중에 대화를 동일한 모델에 유지하고, 데이터 준비 시 관련 예시를 함께 유지합니다.

<Card title="Chat Completion 세부 정보" href="/ko/model-distillation/proxy/chat-completions" arrow="true">
  스트리밍, 도구, 구조화된 출력, 공급자 매개변수 및 요청 우선순위에 대해 알아보세요.
</Card>
