> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo-platform/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo-platform/_mcp/server.

# Upsert ModelProvider

PUT /apis/models/v2/workspaces/{workspace}/providers/{name}
Content-Type: application/json

Create or update a model provider.

Reference: https://docs.nvidia.com/nemo-platform/nemo-platform/v0.3.0/documentation/reference/api-reference/model-providers/upsert-provider-apis-models-v-2-workspaces-workspace-providers-name-put

## Request

### Path parameters

- `workspace` (string, required)
- `name` (string, required)

### Body (application/json)

- `host_url` (string, required) — The network endpoint URL for the model provider
- `project` (string, optional) — The URN of the project associated with this model provider
- `description` (string, optional) — Optional description of the model provider
- `api_key_secret_name` (string, optional) — Reference to an API key secret stored in the Secrets service. Create the secret first via secrets API, then pass the secret name here.
- `enabled_models` (list of string, optional) — Optional list of specific models to enable from this provider
- `default_extra_body` (map from string to any, optional) — Default body parameters for inference requests. Can be overridden by user requests.
- `default_extra_headers` (map from string to string, optional) — Default headers for inference requests. Can be overridden by user requests.
- `required_extra_body` (map from string to any, optional) — Required body parameters for inference requests. Cannot be overridden by user requests.
- `required_extra_headers` (map from string to string, optional) — Required headers for inference requests. Cannot be overridden by user requests.
- `model_deployment_id` (string, optional) — Optional reference to the ModelDeployment ID if this provider is associated with a deployment
- `status` (enum, optional) — Status of the model provider
  - Allowed values: `UNKNOWN`, `CREATED`, `PENDING`, `READY`, `ERROR`, `DELETING`, `DELETED`, `LOST`
- `status_message` (string, optional) — Status message
- `auth_header_format` (string, optional) — Jinja2 template string controlling how the API key secret is sent to the upstream. Must contain exactly one variable named `auth_secret`, which is substituted with the resolved secret value at request time. Example: `'X-Api-Key: {{ auth_secret }}'`. If not set, defaults to `'Authorization: Bearer {{ auth_secret }}'`.

## Response

### 200

Create or update a model provider

- `name` (string, required) — Name of the entity. Name/workspace combo must be unique across all entities. Name must start with a lowercase letter, be 2-63 characters, and use lowercase letters, digits, hyphens, and dots (no consecutive hyphens, cannot end with a hyphen).
- `workspace` (string, required) — The workspace of the entity. Allowed characters: letters (a-z, A-Z), digits (0-9), underscores, hyphens, and dots.
- `created_at` (datetime, required) — The timestamp of model entity creation
- `updated_at` (datetime, required) — The timestamp of the last model entity update
- `host_url` (string, required) — The network endpoint URL for the model provider
- `id` (string, optional) — Unique identifier for the model provider
- `project` (string, optional) — The URN of the project associated with this entity.
- `description` (string, optional) — Optional description of the model provider
- `api_key_secret_name` (string, optional) — Reference to the API key stored in Secrets service
- `served_models` (list of object, optional) — List of models served by this provider with routing information for IGW
  - `model_entity_id` (string, required) — Model Entity identifier as workspace/name (e.g., 'my-ws/my-model')
  - `served_model_name` (string, required) — The actual model name to send to the backend endpoint in the 'model' field
- `enabled_models` (list of string, optional) — Optional list of specific models to enable from this provider. If not set, all discovered models are enabled.
- `status` (enum, optional, default: UNKNOWN) — Current status of the model provider, populated by models service
  - Allowed values: `UNKNOWN`, `CREATED`, `PENDING`, `READY`, `ERROR`, `DELETING`, `DELETED`, `LOST`
- `status_message` (string, optional, default: ) — Detailed status message, populated by models service
- `default_extra_body` (map from string to any, optional) — Default body parameters for inference requests. Can be overridden by user requests.
- `default_extra_headers` (map from string to string, optional) — Default headers for inference requests. Can be overridden by user requests.
- `required_extra_body` (map from string to any, optional) — Required body parameters for inference requests. Cannot be overridden by user requests.
- `required_extra_headers` (map from string to string, optional) — Required headers for inference requests. Cannot be overridden by user requests.
- `model_deployment_id` (string, optional) — Optional reference to the ModelDeployment ID if this provider was auto-created for a deployment
- `auth_context` (object, optional) — Auth context captured at provider creation.
  - `principal_id` (string, required) — The principal's unique identifier
  - `principal_email` (string, optional) — The principal's email address
  - `principal_groups` (list of string, optional) — Groups the principal belongs to
  - `principal_on_behalf_of` (string, optional) — If acting on behalf of another principal, their principal ID
  - `principal_on_behalf_of_groups` (list of string, optional) — Groups the on-behalf-of principal belongs to
  - `principal_on_behalf_of_email` (string, optional) — The on-behalf-of principal's email address
- `auth_header_format` (string, optional) — Jinja2 template string controlling how the API key secret is sent to the upstream. Must contain exactly one variable named `auth_secret`, which is substituted with the resolved secret value at request time. Example: `'X-Api-Key: {{ auth_secret }}'`. If not set, defaults to `'Authorization: Bearer {{ auth_secret }}'`.

## Examples

**Request**

```json
{
  "host_url": "string"
}
```

**Response**

```json
{
  "name": "llama-3.1-8b",
  "workspace": "string",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z",
  "host_url": "string",
  "id": "string",
  "project": "string",
  "description": "string",
  "api_key_secret_name": "string",
  "served_models": [
    {
      "model_entity_id": "string",
      "served_model_name": "string"
    }
  ],
  "enabled_models": [
    "string"
  ],
  "status": "UNKNOWN",
  "status_message": "",
  "default_extra_body": {},
  "default_extra_headers": {},
  "required_extra_body": {},
  "required_extra_headers": {},
  "model_deployment_id": "string",
  "auth_context": {
    "principal_id": "string",
    "principal_email": "string",
    "principal_groups": [
      "string"
    ],
    "principal_on_behalf_of": "string",
    "principal_on_behalf_of_groups": [
      "string"
    ],
    "principal_on_behalf_of_email": "string"
  },
  "auth_header_format": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/apis/models/v2/workspaces/workspace/providers/name"

payload = { "host_url": "string" }
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/apis/models/v2/workspaces/workspace/providers/name';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json'},
  body: '{"host_url":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/apis/models/v2/workspaces/workspace/providers/name"

	payload := strings.NewReader("{\n  \"host_url\": \"string\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/apis/models/v2/workspaces/workspace/providers/name")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"host_url\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.example.com/apis/models/v2/workspaces/workspace/providers/name")
  .header("Content-Type", "application/json")
  .body("{\n  \"host_url\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.example.com/apis/models/v2/workspaces/workspace/providers/name', [
  'body' => '{
  "host_url": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/apis/models/v2/workspaces/workspace/providers/name");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"host_url\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["host_url": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/apis/models/v2/workspaces/workspace/providers/name")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```