# Create or update a model provider

Create or update a model provider

> Page: https://langwatch.ai/docs/api-reference/model-providers/update-model-providers
> Source: https://github.com/langwatch/langwatch/blob/main/docs/api-reference/model-providers/update-model-providers.mdx
> Index of all pages: https://langwatch.ai/docs/llms.txt

## Endpoint

`PUT https://app.langwatch.ai/api/v1/model-providers/{provider}`

## Authentication

### project_api_key

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

```json
{"id":"project_api_key","type":"apiKey","in":"header","name":"X-Auth-Token"}
```

## Parameters

### provider (path, required)

```json
{"type":"string","minLength":1}
```

## Request body (required)

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "enabled": {"type":"boolean"},
    "customKeys": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "customModels": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "modelId": {"type":"string","minLength":1},
              "displayName": {"type":"string","minLength":1},
              "mode": {"type":"string","enum":["chat","embedding"]},
              "maxTokens": {"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},
              "supportedParameters": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "temperature",
                    "max_tokens",
                    "top_p",
                    "frequency_penalty",
                    "presence_penalty",
                    "top_k",
                    "min_p",
                    "repetition_penalty",
                    "seed",
                    "reasoning",
                    "verbosity"
                  ]
                }
              },
              "multimodalInputs": {
                "type": "array",
                "items": {"type":"string","enum":["image","file","audio"]}
              }
            },
            "required": ["modelId","displayName","mode"],
            "additionalProperties": false
          }
        },
        {"type":"array","items":{"type":"string"}}
      ]
    },
    "customEmbeddingsModels": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "modelId": {"type":"string","minLength":1},
              "displayName": {"type":"string","minLength":1},
              "mode": {"type":"string","enum":["chat","embedding"]},
              "maxTokens": {"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},
              "supportedParameters": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "temperature",
                    "max_tokens",
                    "top_p",
                    "frequency_penalty",
                    "presence_penalty",
                    "top_k",
                    "min_p",
                    "repetition_penalty",
                    "seed",
                    "reasoning",
                    "verbosity"
                  ]
                }
              },
              "multimodalInputs": {
                "type": "array",
                "items": {"type":"string","enum":["image","file","audio"]}
              }
            },
            "required": ["modelId","displayName","mode"],
            "additionalProperties": false
          }
        },
        {"type":"array","items":{"type":"string"}}
      ]
    },
    "extraHeaders": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {"key":{"type":"string"},"value":{"type":"string"}},
        "required": ["key","value"]
      }
    },
    "defaultModel": {"type":"string"}
  },
  "required": ["enabled"]
}
```

## Request example

```bash
curl --request PUT \
  --url 'https://app.langwatch.ai/api/v1/model-providers/<provider>' \
  --header "X-Auth-Token: $LANGWATCH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"enabled":false,"customKeys":{},"customModels":[{"modelId":"string","displayName":"string","mode":"chat","maxTokens":0,"supportedParameters":["temperature"],"multimodalInputs":["image"]}],"customEmbeddingsModels":[{"modelId":"string","displayName":"string","mode":"chat","maxTokens":0,"supportedParameters":["temperature"],"multimodalInputs":["image"]}],"extraHeaders":[{"key":"string","value":"string"}],"defaultModel":"string"}'
```

## Responses

### 200

Success

#### application/json

Schema:

```json
{
  "type": "object",
  "additionalProperties": {
    "type": "object",
    "properties": {
      "id": {"type":"string"},
      "provider": {"type":"string"},
      "enabled": {"type":"boolean"},
      "customKeys": {
        "anyOf": [
          {
            "type": "object",
            "propertyNames": {"type":"string"},
            "additionalProperties": {}
          },
          {"type":"null"}
        ]
      },
      "deploymentMapping": {"anyOf":[{},{"type":"null"}]},
      "models": {"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},
      "embeddingsModels": {"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},
      "customModels": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "modelId": {"type":"string","minLength":1},
                "displayName": {"type":"string","minLength":1},
                "mode": {"type":"string","enum":["chat","embedding"]},
                "maxTokens": {
                  "anyOf": [{"type":"number","exclusiveMinimum":0},{"type":"null"}]
                },
                "supportedParameters": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "temperature",
                      "max_tokens",
                      "top_p",
                      "frequency_penalty",
                      "presence_penalty",
                      "top_k",
                      "min_p",
                      "repetition_penalty",
                      "seed",
                      "reasoning",
                      "verbosity"
                    ]
                  }
                },
                "multimodalInputs": {
                  "type": "array",
                  "items": {"type":"string","enum":["image","file","audio"]}
                }
              },
              "required": ["modelId","displayName","mode"],
              "additionalProperties": false
            }
          },
          {"type":"null"}
        ]
      },
      "customEmbeddingsModels": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "modelId": {"type":"string","minLength":1},
                "displayName": {"type":"string","minLength":1},
                "mode": {"type":"string","enum":["chat","embedding"]},
                "maxTokens": {
                  "anyOf": [{"type":"number","exclusiveMinimum":0},{"type":"null"}]
                },
                "supportedParameters": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "temperature",
                      "max_tokens",
                      "top_p",
                      "frequency_penalty",
                      "presence_penalty",
                      "top_k",
                      "min_p",
                      "repetition_penalty",
                      "seed",
                      "reasoning",
                      "verbosity"
                    ]
                  }
                },
                "multimodalInputs": {
                  "type": "array",
                  "items": {"type":"string","enum":["image","file","audio"]}
                }
              },
              "required": ["modelId","displayName","mode"],
              "additionalProperties": false
            }
          },
          {"type":"null"}
        ]
      },
      "disabledByDefault": {"type":"boolean"},
      "extraHeaders": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {"key":{"type":"string"},"value":{"type":"string"}},
              "required": ["key","value"],
              "additionalProperties": false
            }
          },
          {"type":"null"}
        ]
      }
    },
    "required": ["provider","enabled","customKeys","deploymentMapping"],
    "additionalProperties": false
  }
}
```

### 400

Bad Request

#### application/json

Schema:

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

### 401

Unauthorized

#### application/json

Schema:

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

### 409

Conflict

#### application/json

Schema:

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

### 422

Unprocessable Entity

#### application/json

Schema:

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

### 500

Internal Server Error

#### application/json

Schema:

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

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.
