---
title: "Create a custom provider"
description: "To update an existing provider, use `PATCH /api/providers/{provider_id}/`."
---

<a id="playground-button:docs/apis/models/create-custom-provider"></a>

**POST** `https://api.respan.ai/api/providers/`

To update an existing provider, use `PATCH /api/providers/{provider_id}/`.

## Servers

`https://api.respan.ai` — Respan API Server

<a id="request.auth"></a>

## Authentication

<a id="request.auth.Authorization"></a>

### RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer &lt;RESPAN_API_KEY&gt;. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -&gt; Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: `bearer`; format: `Respan API key`.


```http
Authorization: Bearer $RESPAN_API_KEY
```


**Or:**

### DashboardJwt

Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

HTTP scheme: `bearer`; format: `Dashboard JWT`.


```http
Authorization: Bearer $RESPAN_DASHBOARD_JWT
```


<a id="request"></a>

## Request body

A request body is required.

### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Required body | — |
| <a id="request.body.provider_id"></a>`provider_id` | `string` | Required in parent | Unique provider identifier within your organization.<br />Example: `"my-vllm"` |
| <a id="request.body.provider_name"></a>`provider_name` | `string` | Required in parent | Human-readable provider name.<br />Example: `"My vLLM Server"` |
| <a id="request.body.extra_kwargs"></a>`extra_kwargs` | `object` | Optional | Provider configuration. Put provider credentials under extra_kwargs.api_key.<br />Additional properties are allowed<br />Example: `{"api_key":"sk_provider_xxxxx","base_url":"https://vllm.example.com/v1","timeout":60}` |


<details class="api-schema-source">
<summary>OpenAPI request schema</summary>


```json
{
  "type": "object",
  "required": [
    "provider_id",
    "provider_name"
  ],
  "properties": {
    "provider_id": {
      "type": "string",
      "description": "Unique provider identifier within your organization.",
      "example": "my-vllm"
    },
    "provider_name": {
      "type": "string",
      "description": "Human-readable provider name.",
      "example": "My vLLM Server"
    },
    "extra_kwargs": {
      "type": "object",
      "description": "Provider configuration. Put provider credentials under extra_kwargs.api_key.",
      "additionalProperties": true,
      "example": {
        "api_key": "sk_provider_xxxxx",
        "base_url": "https://vllm.example.com/v1",
        "timeout": 60
      }
    }
  }
}
```

</details>

<a id="response"></a>

## Responses

### 201

Created provider.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | Additional properties are allowed |
| <a id="response.body.id"></a>`id` | `string` | Required in parent | Provider string ID. Same value as `provider_id`.<br />Example: `"my-vllm"` |
| <a id="response.body.provider_id"></a>`provider_id` | `string` | Required in parent | Unique provider identifier within your organization.<br />Example: `"my-vllm"` |
| <a id="response.body.provider_name"></a>`provider_name` | `string` | Required in parent | Human-readable provider name.<br />Example: `"My vLLM Server"` |
| <a id="response.body.extra_kwargs"></a>`extra_kwargs` | `object` | Optional | Stored provider configuration. The current backend returns this object, including credentials it contains; handle the response as sensitive.<br />Additional properties are allowed<br />Example: `{"base_url":"https://vllm.example.com/v1"}` |
| <a id="response.body.created_at"></a>`created_at` | `string or null` | Optional | Format: `date-time` |
| <a id="response.body.updated_at"></a>`updated_at` | `string or null` | Optional | Format: `date-time` |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "required": [
    "id",
    "provider_id",
    "provider_name"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Provider string ID. Same value as `provider_id`.",
      "example": "my-vllm"
    },
    "provider_id": {
      "type": "string",
      "description": "Unique provider identifier within your organization.",
      "example": "my-vllm"
    },
    "provider_name": {
      "type": "string",
      "description": "Human-readable provider name.",
      "example": "My vLLM Server"
    },
    "extra_kwargs": {
      "type": "object",
      "description": "Stored provider configuration. The current backend returns this object, including credentials it contains; handle the response as sensitive.",
      "additionalProperties": true,
      "example": {
        "base_url": "https://vllm.example.com/v1"
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    }
  },
  "additionalProperties": true
}
```

</details>

<a id="response.error"></a>

### 400

Bad Request

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | — |
| `detail` | `string` | Optional | — |
| `error` | `string` | Optional | — |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "error": {
      "type": "string"
    }
  }
}
```

</details>

##### Example


```json
{
  "error": "Invalid request"
}
```


### 403

The API key is missing, invalid or expired.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | — |
| `detail` | `string` | Required in parent | — |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
```

</details>

##### Example


```json
{
  "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
}
```


## OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

<!-- openapi-operation:start -->
<details class="api-schema-source">
<summary>OpenAPI operation</summary>


```json
{
  "summary": "Create a custom provider",
  "operationId": "createCustomProvider",
  "tags": [
    "Models"
  ],
  "description": "To update an existing provider, use `PATCH /api/providers/{provider_id}/`.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "provider_id",
            "provider_name"
          ],
          "properties": {
            "provider_id": {
              "type": "string",
              "description": "Unique provider identifier within your organization.",
              "example": "my-vllm"
            },
            "provider_name": {
              "type": "string",
              "description": "Human-readable provider name.",
              "example": "My vLLM Server"
            },
            "extra_kwargs": {
              "type": "object",
              "description": "Provider configuration. Put provider credentials under extra_kwargs.api_key.",
              "additionalProperties": true,
              "example": {
                "api_key": "sk_provider_xxxxx",
                "base_url": "https://vllm.example.com/v1",
                "timeout": 60
              }
            }
          }
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Created provider.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "id",
              "provider_id",
              "provider_name"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Provider string ID. Same value as `provider_id`.",
                "example": "my-vllm"
              },
              "provider_id": {
                "type": "string",
                "description": "Unique provider identifier within your organization.",
                "example": "my-vllm"
              },
              "provider_name": {
                "type": "string",
                "description": "Human-readable provider name.",
                "example": "My vLLM Server"
              },
              "extra_kwargs": {
                "type": "object",
                "description": "Stored provider configuration. The current backend returns this object, including credentials it contains; handle the response as sensitive.",
                "additionalProperties": true,
                "example": {
                  "base_url": "https://vllm.example.com/v1"
                }
              },
              "created_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              }
            },
            "additionalProperties": true
          }
        }
      }
    },
    "400": {
      "description": "Bad Request",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "detail": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            }
          },
          "example": {
            "error": "Invalid request"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    }
  },
  "security": [
    {
      "RespanApiKey": []
    },
    {
      "DashboardJwt": []
    }
  ]
}
```

</details>
<!-- openapi-operation:end -->

<!-- openapi-path-item:start -->
<details class="api-schema-source">
<summary>OpenAPI path metadata</summary>


```json
{}
```

</details>
<!-- openapi-path-item:end -->

<!-- openapi-components:start -->
<details class="api-schema-source">
<summary>Referenced OpenAPI components</summary>


```json
{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "DashboardJwt": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Dashboard JWT",
      "description": "Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.",
      "x-fern-bearer": {
        "name": "dashboardJwt",
        "env": "RESPAN_DASHBOARD_JWT"
      }
    },
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}
```

</details>
<!-- openapi-components:end -->
