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

# Deploy a model

> Serve an open model on one of your project's GPUs with an OpenAI-compatible API.

**Models** lets you pick an open model from Hugging Face and serve it on one of your project's GPUs, with nothing to set up on a server. You get an **OpenAI-compatible API**, so code written for the OpenAI SDK works once you change the base URL.

## Deploy a model

**1. Browse models**

In the console, open **Models → Explore**. Search or browse. With **Fits my GPUs** on (the default), you see only models that can run on your project's GPUs. Models marked **Verified** have been tested end to end and are the easiest place to start.

**2. Deploy**

Open a model and click **Deploy**. Pick the GPU to run it on; the form shows how much GPU memory the model needs and marks a recommended GPU. Under **Advanced** you can name the deployment and choose an SSH key, which you only need if you want a shell on its server.

Your deployment gets an HTTPS endpoint you can call from anywhere. It answers only requests that include the deployment's API key.

![A model's page with its parameters, weights and estimated GPU memory, and a Ready to deploy panel showing how it fits on B300, B200 and H200](https://mintcdn.com/infinitecompute/ZfaVXu9meKhYJC2I/images/console/model-deploy.png?fit=max\&auto=format\&n=ZfaVXu9meKhYJC2I\&q=85\&s=1ba8a8a6c81979eef4465f085303453c)

**3. Copy your API key**

After you deploy, the panel shows the deployment's **API key**. Copy it now and store it somewhere safe: it's shown only once and can't be shown again. Then confirm with **I've saved this key**.

The panel follows the deployment's progress. You can close it: the deployment keeps going and is listed under **Models → Deployments**. Large models can take a while to load.

**4. Get your endpoint**

In **Models → Deployments**, wait until the deployment's **Status** shows it's ready, then open it. Its page shows the **endpoint URL** and ready-to-copy code samples.

> [!WARNING]
>
> Treat the API key like a password. Don't commit it to git or paste it into shared notebooks. Load it from an environment variable instead.

## Call your model

Set the endpoint from the deployment page and the API key you copied when you deployed as environment variables, then call the API. The endpoint URL already ends in `/v1`, so use it as it is, without adding `/v1` again.

```python Python theme={null}
# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ["IC_MODEL_ENDPOINT"],  # endpoint URL from the deployment page
    api_key=os.environ["IC_MODEL_API_KEY"],     # API key you copied when you deployed
)

response = client.chat.completions.create(
    model="<model-name>",  # the model name shown on the deployment page
    messages=[{"role": "user", "content": "Explain attention in one paragraph."}],
)
print(response.choices[0].message.content)
```

```bash curl theme={null}
curl "$IC_MODEL_ENDPOINT/chat/completions" \
  -H "Authorization: Bearer $IC_MODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<model-name>",
    "messages": [{"role": "user", "content": "Explain attention in one paragraph."}]
  }'
```

> [!TIP]
>
> The code samples on the deployment page already have the right endpoint and model name filled in. Copying one is the quickest way to start.

## When you're done

A deployment keeps a GPU reserved while it exists, even when it's stopped, and that time is measured in GPU-hours. When you no longer need it:

* **To keep it for later**, choose **Open server** in the deployment's **⋮** menu and park that server. Resume the server to use the model again.
* **To remove it**, choose **Delete…** in the same menu and confirm with **Delete deployment**.

See [Park, stop, or delete](https://docs.infinitecompute.ai/guides/park-stop-delete.md) and [How usage is measured](https://docs.infinitecompute.ai/billing/metering.md).

> [!NOTE]
>
> If you lose a deployment's API key, it can't be shown again. Delete the deployment and deploy the model again to get a new key.

## Related

> [card] [Models](https://docs.infinitecompute.ai/console/models.md)
>
> Explore models and manage deployments.

> [card] [How usage is measured](https://docs.infinitecompute.ai/billing/metering.md)
>
> When the clock starts and stops.

> [card] [Usage](https://docs.infinitecompute.ai/console/usage.md)
>
> GPU-hours by day and by server.

> [card] [Getting help](https://docs.infinitecompute.ai/guides/getting-help.md)
>
> Who to contact and what to include.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.