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

# Adding Custom Models

> Learn how to add custom and fine-tuned models to your Portkey Model Catalog for seamless integration.

Portkey's Model Catalog is designed to be a central hub for all the models you use, providing a unified interface for both supported and private models. By adding your custom or fine-tuned models to the catalog, you can seamlessly integrate them into your applications, leverage Portkey's unified API signature, and benefit from centralized logging, monitoring, and management.

This is especially useful for:

* **Fine-tuned Models**: Integrating your fine-tuned versions of popular models (e.g., `ft:gpt-4.1-nano`).
* **Internal/Proprietary Models**: Using your own in-house models through the Portkey gateway.
* **Models Not Natively Supported**: Adding models from providers that Portkey doesn't yet have a direct integration with, while mapping them to a compatible API signature.

## Adding a New Custom Model

You can add a custom model directly from your Portkey dashboard.

![](https://mintcdn.com/portkey-docs/QFjngWBmb6CT7QXC/images/custom-model.gif?s=5a83b27113321140daa77eb0db2d667d)

1. Navigate to the relevant [**Integration**](https://app.portkey.ai/integrations) in your Portkey account, select the Integration for which you want to add a custom model.
2. Select the **Model Provisioning** step from steps.
3. Click the **Add Model** button on the top-right corner of the page.
4. In the **Add Custom Model** form, enter the **Model Slug** and an optional **Short Description**.
5. Choose a **Model Type**: **Fine-tuned Model** or **Custom Model**. If you pick Fine-tuned Model, select the **Base Model** it is based on.
6. Optionally, turn on **Add custom pricing for this model** and enter the input cost, output cost, and cache pricing.
7. Optionally, turn on **Pricing Adjustments** to apply a discount or markup multiplier to this model.
8. Optionally, set a **Custom Host** and any **Custom Headers** for this model.
9. Click **Apply** to save the model.

![Add Custom Model Form](https://mintcdn.com/portkey-docs/QFjngWBmb6CT7QXC/images/custom-model.png?fit=max\&auto=format\&n=QFjngWBmb6CT7QXC\&q=85\&s=b49a0016eb73f549154f93f347769d7f)

### Configuration Fields

Here’s a breakdown of each field in the form:

> [card] Model Slug
>
> A unique, lowercase identifier for your model (e.g., `my-custom-model-v1`). This slug is what you will use in your API requests to reference this model.

> [card] Short Description
>
> An optional, brief description to help you and your team understand the model's purpose or version.

> [card] Model Type
>
> Specify the nature of your model:
>
> * **Fine-tuned Model** (based on an existing model): Select this if you are adding a fine-tuned version of a base model (like `ft:gpt-3.5-turbo`). Selecting this option shows the **Base Model** field.
> * **Custom Model** (self hosted or proprietary): Select this for any other model, such as proprietary in-house models.

> [card] Base Model (Fine-tuned Model only)
>
> Select an existing model that your fine-tuned model is based on in terms of **API compatibility**. For example, if your model accepts the same request payload and returns the same response structure as `gpt-4`, you would select `gpt-4` here. This ensures Portkey can correctly format requests and parse responses.

> [card] Add custom pricing for this model
>
> Enable this toggle if you want to associate specific costs with your model. This is useful for accurate cost tracking and budget management within Portkey's dashboard. Once enabled, you can set:
>
> * **Input Cost**: Price in USD for **1 million input (request) tokens**.
> * **Output Cost**: Price in USD for **1 million output (response) tokens**.
> * **Cache Pricing**: Optional JSON for cache token prices, for example `{"cache_write_input_token": {"price": 3.75}, "cache_read_input_token": {"price": 0.3}}`.

> [card] Pricing Adjustments
>
> Enable this toggle to apply a discount or markup multiplier to this model's base price. Pick **Default** mode for the common token types (default, request, response, cache read, cache write), or **Custom** mode to provide the full multiplier as JSON. A multiplier of `1` leaves pricing unchanged, `0.8` is a 20% discount, and `1.2` is a 20% markup. See [Per-Model Pricing Adjustments](https://docs.portkey.ai/docs/product/model-catalog/pricing-adjustments.md#per-model-pricing-adjustments) for details and version requirements.

> [card] Custom Host (Optional)
>
> The upstream base URL for this model, for example `https://your-custom-endpoint.com`. See [Per-model custom host and headers](#per-model-custom-host-and-headers).

> [card] Custom Headers
>
> Header name and value pairs that Portkey sends with requests for this model. Click **Add Header** to add more rows.

> [!NOTE]
>
> A model with custom pricing is billed at exactly that price. [Pricing adjustments](https://docs.portkey.ai/docs/product/model-catalog/pricing-adjustments.md#per-model-pricing-adjustments) set at the model level or the Integration level are ignored for it. Build any discount or markup into the custom price itself.

## Per-model custom host and headers

Each integration model can carry its own routing config — useful when several custom models share one integration but hit different upstreams or need different headers.

| Field | Purpose |
| :- | :- |
| `custom_host` | Upstream base URL for this model (e.g. a private or regional endpoint) |
| `custom_headers` | String-to-string map of headers Portkey sends with requests for this model |

**Precedence**

* Model-level `custom_headers` override integration-level `custom_headers` for that model.
* A request-time / header-level `custom_host` still takes priority over the model-level value.

Configure via the [Update Model Access](https://docs.portkey.ai/docs/api-reference/admin-api/control-plane/integrations/models/update-model-access.md) API (`models[].configurations`), or set the **Custom Host** and **Custom Headers** fields when adding or editing the model in Model Provisioning.

```bash theme={"system"}
curl -X PUT "https://api.portkey.ai/v1/integrations/YOUR_INTEGRATION_SLUG/models" \
  -H "Content-Type: application/json" \
  -H "x-portkey-api-key: $PORTKEY_API_KEY" \
  -d '{
    "models": [
      {
        "slug": "my-custom-model-v1",
        "enabled": true,
        "is_custom": true,
        "base_model_slug": "gpt-4o",
        "configurations": {
          "custom_host": "https://llm.internal.example.com/v1",
          "custom_headers": {
            "x-tenant-id": "acme-prod",
            "x-region": "us-east-1"
          }
        }
      }
    ]
  }'
```

> [!NOTE]
>
> `custom_headers` must be a flat string-to-string object. See [Custom hosts](https://docs.portkey.ai/docs/product/ai-gateway/custom-hosts.md) for URL validation rules on `custom_host`.

## Using Your Custom Model

Once you've added your custom model, you can use it just like any other model in the catalog. Simply reference its **Model Slug** in your API calls.

For example, to use a custom model with the slug `my-custom-model-v1` in a chat completion request, you would set it as the `model` in your provider configuration or pass it directly in the request header:

> [tab] cURL
>
> ```bash theme={"system"}
> curl -X POST https://api.portkey.ai/v1/chat/completions \
>   -H "Content-Type: application/json" \
>   -H "x-portkey-api-key: YOUR_PORTKEY_API_KEY" \
>   -d '{
>     "model": "@provider/my-custom-model-v1",
>     "messages": [
>       {
>         "role": "user",
>         "content": "Hello, what can you do?"
>       }
>     ]
>   }'
> ```

> [tab] Python
>
> ```python theme={"system"}
> from portkey_ai import Portkey
>
> client = Portkey(
>     api_key="YOUR_PORTKEY_API_KEY"
> )
>
> response = client.chat.completions.create(
>     model="@provider/my-custom-model-v1",
>     messages=[
>         {
>             "role": "user",
>             "content": "Hello, what can you do?"
>         }
>     ]
> )
>
> print(response.choices[0].message.content)
> ```

Portkey will route the request to the provider associated with the base model you selected, using your custom model's slug.

***

> [card] [Portkey is now PRISMA AIRS AI Gateway. See it in action.](https://www.paloaltonetworks.in/ai-security/ai-gateway?utm_source=portkey\&utm_medium=referral\&utm_campaign=prisma_airs\&utm_content=docs_nav#contact)
>
> Contact Us


## Related topics

- [Model Catalog](https://docs.portkey.ai/docs/product/model-catalog.md)
- [Delete Custom Model](https://docs.portkey.ai/docs/api-reference/admin-api/control-plane/integrations/models/delete-custom-model.md)
- [Azure AI Foundry](https://docs.portkey.ai/docs/integrations/llms/azure-foundry.md)
- [Model Pricing and Cost Management](https://docs.portkey.ai/docs/product/observability/cost-management.md)
- [Integrations](https://docs.portkey.ai/docs/product/model-catalog/integrations.md)


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