> ## 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.

# Connect your application

> Create a task and send your first verified request through the Model Distillation proxy.

Most Chat Completions applications only need a new base URL, API key, and model name. The rest of the request and response handling stays the same.

## Before you begin

You need a W\&B API key, a task with routing applied, and the task's 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>

Omit `wandb.entity` only when the task belongs to the API key's default entity.

## Verify the integration

Return to the task overview after sending a request. Confirm that:

* the request count increased;
* the expected model served the request;
* the saved input and answer look correct.

If the proxy says the task does not exist in a personal entity, add the team name in `metadata["wandb.entity"]`.

## Preserve conversation identity

Use the same `wandb.thread_id` for every request in one conversation. This keeps a conversation on the same model during a gradual rollout and keeps related examples together when preparing data.

<Card title="Chat Completions details" href="/model-distillation/proxy/chat-completions" arrow="true">
  Learn about streaming, tools, structured output, provider parameters, and request precedence.
</Card>
