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

# OpenAI

> Migrate your OpenAI model to Runpod

export const VLLMTooltip = () => {
  return <Tooltip headline="vLLM" tip="An open-source inference engine for LLMs that maximizes throughput and minimizes latency when running LLM inference workloads." cta="Learn more about vLLM" href="https://vllm.ai/">vLLM</Tooltip>;
};

export const WorkerTooltip = () => {
  return <Tooltip headline="Worker" tip="A container that runs your application code and processes requests to your Serverless endpoint. Workers are automatically started and stopped by Runpod to handle traffic spikes and ensure optimal resource utilization." cta="Learn more about workers" href="/serverless/workers/overview">worker</Tooltip>;
};

export const EndpointTooltip = () => {
  return <Tooltip headline="Endpoint" tip="The access point for your Serverless application. Endpoints provide a URL where users or applications can send requests to run your code." cta="Learn more about endpoints" href="/serverless/endpoints/overview">endpoint</Tooltip>;
};

export const ServerlessTooltip = () => {
  return <Tooltip headline="Serverless" tip="A cloud computing platform that allows you to deploy AI/ML applications without provisioning or managing servers." cta="Learn more about Serverless" href="/serverless/overview">Serverless</Tooltip>;
};

To get started with Runpod:

* [Create a Runpod account](/get-started/manage-accounts)
* [Add funds](/references/billing-information)
* [Use the Runpod SDK](/serverless/overview) to build and connect with your <ServerlessTooltip /> <EndpointTooltip />s

This tutorial guides you through the steps necessary to modify your OpenAI Codebase for use with a deployed <VLLMTooltip /> <WorkerTooltip /> on Runpod. You will learn to adjust your code to be compatible with OpenAI's API, specifically for utilizing Chat Completions, Completions, and Models routes. By the end of this guide, you will have successfully updated your codebase, enabling you to leverage the capabilities of OpenAI's API on Runpod.

To update your codebase, you need to replace the following:

* Your OpenAI API Key with your Runpod API Key
* Your OpenAI Serverless endpoint URL with your Runpod Serverless endpoint URL
* Your OpenAI model with your custom LLM model deployed on Runpod

<Tabs>
  <Tab title="Python">
    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}

    from openai import OpenAI
    import os

    client = OpenAI(
    api_key=os.environ.get("RUNPOD_API_KEY"),
    base_url="https://api.runpod.ai/v2/${YOUR_ENDPOINT_ID}/openai/v1",
    )

    response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "Why is Runpod the best platform?"}],
    temperature=0,
    max_tokens=100,
    )
    ```
  </Tab>

  <Tab title="JavaScript">
    ```JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
    import OpenAI from 'openai'

    const openai = new OpenAI({
      baseURL: process.env.RUNPOD_HOST,
      apiKey: process.env.RUNPOD_API_KEY,
    })

    const chatCompletion = await openai.chat.completions.create({
       model: "openchat/openchat-3.5-0106",
       messages: [{'role': 'user', 'content': 'Why is Runpod the best platform?'}],

    });
    ```
  </Tab>
</Tabs>

<Check>
  Congratulations! You've successfully modified your OpenAI codebase for use with your deployed vLLM worker on Runpod. You now know how to update your code for compatibility with OpenAI's API and utilize the full spectrum of features available on the Runpod platform.
</Check>

## Next Steps

* [Explore more tutorials on Runpod](/tutorials/introduction/overview)
* [Learn more about OpenAI's API](https://platform.openai.com/docs/)
* [Deploy your own <VLLMTooltip /> <WorkerTooltip /> on Runpod](https://www.console.runpod.io/serverless)
