> 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.

# Update VirtualModel

PATCH /apis/inference-gateway/v2/workspaces/{workspace}/virtual-models/{name}
Content-Type: application/json

Partially update a VirtualModel.

Only fields present in the request body are modified.  Fields absent from
the request body retain their current values.

Reference: https://docs.nvidia.com/nemo-platform/nemo-platform/v0.3.0/documentation/reference/api-reference/virtual-models/update-virtual-model

## Request

### Path parameters

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

### Body (application/json)

- `default_model_entity` (string, optional) — Model entity to route to, in "workspace/name" format. Written into request["model"] before the request middleware pipeline runs. If omitted, a request middleware plugin must handle backend routing itself. Set to null to clear an existing value.
- `autoprovisioned` (boolean, optional, default: false) — Marks this VirtualModel as controller-managed. The Models controller will delete it once no ModelProvider serves the matching entity. Setting this manually opts the VirtualModel into that cleanup behavior.
- `models` (list of object, optional) — Model entity references used by this VirtualModel. A per-entry backend_format overrides the referenced ModelEntity backend_format when IGW resolves the backend format for a request.
  - `model` (string, required)
  - `backend_format` (enum, optional, nullable) — Optional backend format override for this VirtualModel entry.
    - Allowed values: `OPENAI_CHAT`, `ANTHROPIC_MESSAGES`
- `request_middleware` (list of object, optional) — Ordered list of middleware plugins applied before proxying to the backend. Each entry is a MiddlewareCall with a "name" (plugin identifier) and optional "config_type" and "config_id" fields that reference a stored plugin configuration.
  - `name` (string, required)
  - `config_type` (string, required)
  - `config` (map from string to any, optional)
  - `config_id` (string, optional)
- `response_middleware` (list of object, optional) — Ordered list of middleware plugins applied after the backend response is received, before returning it to the caller.
  - `name` (string, required)
  - `config_type` (string, required)
  - `config` (map from string to any, optional)
  - `config_id` (string, optional)
- `post_response_middleware` (list of object, optional) — Ordered list of middleware plugins invoked after the response has been returned to the caller. Intended for fire-and-forget work (logging, analytics) that must not block or modify the response.
  - `name` (string, required)
  - `config_type` (string, required)
  - `config` (map from string to any, optional)
  - `config_id` (string, optional)
- `override_proxy` (string, optional) — Plugin-provided proxy implementation for IGW to use instead of its default aiohttp proxy. Format: "plugin-name.proxy-name". Leave unset to use the default IGW proxy. Set to null to clear an existing value.

## Response

### 200

Updated virtual model

- `workspace` (string, required) — Workspace identifier
- `id` (string, required)
- `created_at` (datetime, required)
- `created_by` (string, required, nullable)
- `updated_at` (datetime, required)
- `updated_by` (string, required, nullable)
- `entity_id` (string, required) — Alias for id for backwards compatibility.
- `parent` (string, required) — Parent entity ID for nested entities.
- `db_version` (integer, required) — Database version of the entity for optimistic locking.
- `name` (string, optional, default: ) — Entity name within the workspace
- `project` (string, optional) — The name of the project associated with this entity.
- `default_model_entity` (string, optional)
- `autoprovisioned` (boolean, optional, default: false) — Marks this VirtualModel as controller-managed. The Models controller will delete it once no ModelProvider serves the matching entity. Setting this manually opts the VirtualModel into that cleanup behavior.
- `models` (list of object, optional)
  - `model` (string, required)
  - `backend_format` (enum, optional, nullable) — Optional backend format override for this VirtualModel entry.
    - Allowed values: `OPENAI_CHAT`, `ANTHROPIC_MESSAGES`
- `request_middleware` (list of object, optional, default: [])
  - `name` (string, required)
  - `config_type` (string, required)
  - `config` (map from string to any, optional)
  - `config_id` (string, optional)
- `response_middleware` (list of object, optional, default: [])
  - `name` (string, required)
  - `config_type` (string, required)
  - `config` (map from string to any, optional)
  - `config_id` (string, optional)
- `post_response_middleware` (list of object, optional, default: [])
  - `name` (string, required)
  - `config_type` (string, required)
  - `config` (map from string to any, optional)
  - `config_id` (string, optional)
- `override_proxy` (string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "workspace": "string",
  "id": "string",
  "created_at": "2024-01-15T09:30:00Z",
  "created_by": "string",
  "updated_at": "2024-01-15T09:30:00Z",
  "updated_by": "string",
  "entity_id": "string",
  "parent": "string",
  "db_version": 1,
  "name": "",
  "project": "string",
  "default_model_entity": "string",
  "autoprovisioned": false,
  "models": [
    {
      "model": "string",
      "backend_format": "OPENAI_CHAT"
    }
  ],
  "request_middleware": [
    {
      "name": "string",
      "config_type": "string",
      "config": {},
      "config_id": "string"
    }
  ],
  "response_middleware": [
    {
      "name": "string",
      "config_type": "string",
      "config": {},
      "config_id": "string"
    }
  ],
  "post_response_middleware": [
    {
      "name": "string",
      "config_type": "string",
      "config": {},
      "config_id": "string"
    }
  ],
  "override_proxy": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/apis/inference-gateway/v2/workspaces/workspace/virtual-models/name"

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

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

print(response.json())
```

```javascript
const url = 'https://api.example.com/apis/inference-gateway/v2/workspaces/workspace/virtual-models/name';
const options = {method: 'PATCH', headers: {'Content-Type': 'application/json'}, body: '{}'};

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/inference-gateway/v2/workspaces/workspace/virtual-models/name"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", 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/inference-gateway/v2/workspaces/workspace/virtual-models/name")

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

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

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.patch("https://api.example.com/apis/inference-gateway/v2/workspaces/workspace/virtual-models/name")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.example.com/apis/inference-gateway/v2/workspaces/workspace/virtual-models/name', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

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

```swift
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/apis/inference-gateway/v2/workspaces/workspace/virtual-models/name")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```