# Create custom model proxies for external models

> Create custom model proxies for external models - Create custom model proxies for external models in
> the Workshop.

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-05-06T18:17:10.049000+00:00` (UTC).

## Primary page

- [Create custom model proxies for external models](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-ext-model-proxy.html): Full documentation for this topic (HTML).

## Sections on this page

- [Add proxy code](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-ext-model-proxy.html#add-proxy-code): In-page section heading.
- [Create a proxy model](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-ext-model-proxy.html#create-a-proxy-model): In-page section heading.
- [Assemble a proxy model](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-ext-model-proxy.html#assemble-a-proxy-model): In-page section heading.

## Related documentation

- [NextGen UI documentation](https://docs.datarobot.com/en/docs/workbench/index.html): Linked from this page.
- [Registry](https://docs.datarobot.com/en/docs/workbench/nxt-registry/index.html): Linked from this page.
- [Workshop](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/index.html): Linked from this page.
- [compliance documentation](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-directory/nxt-compliance-doc.html): Linked from this page.
- [challenger analysis](https://docs.datarobot.com/en/docs/workbench/nxt-console/nxt-mitigation/nxt-challengers.html): Linked from this page.
- [custom model tests](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-test-custom-model.html): Linked from this page.
- [Add runtime parameters](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/custom-model-runtime-parameters.html): Linked from this page.
- [custom model assembly](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/index.html): Linked from this page.
- [Binary](https://docs.datarobot.com/en/docs/reference/glossary/index.html#classification): Linked from this page.
- [Time Series (Binary)](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-create-custom-model.html#configure-time-series-settings): Linked from this page.
- [Text Generation](https://docs.datarobot.com/en/docs/workbench/nxt-console/nxt-monitoring/nxt-genai-monitoring.html): Linked from this page.
- [Location](https://docs.datarobot.com/en/docs/workbench/nxt-console/nxt-monitoring/nxt-data-drift.html#enable-geospatial-monitoring-for-a-deployment): Linked from this page.
- [custom environments](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/custom-models/custom-model-environments/custom-environments.html#create-a-custom-environment): Linked from this page.
- [register the custom model](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-directory/nxt-register-cus-models.html): Linked from this page.

## Documentation content

To create a custom model as a proxy for an external model, you can add a new proxy model to the [Workshop](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/index.html). A proxy model contains proxy code created to connect with an external model, allowing you to use features like [compliance documentation](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-directory/nxt-compliance-doc.html), [challenger analysis](https://docs.datarobot.com/en/docs/workbench/nxt-console/nxt-mitigation/nxt-challengers.html), and [custom model tests](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-test-custom-model.html) with a model running on infrastructure outside DataRobot.

To create a proxy model:

1. (Optional)Add runtime parametersto the custom model through the model metadata (model-metadata.yaml).
2. Add proxy codeto the custom model through the custom model file (custom.py).
3. Create a proxy modelandassemble the modelfiles in the Workshop.

## Add proxy code

The custom model you create as a proxy for an external model should contain custom code in the `custom.py` file to connect the [proxy model](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-ext-model-proxy.html#create-a-proxy-model) with the externally hosted model; this code is the proxy code. See the [custom model assembly](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/index.html) documentation for more information on writing custom model code.

The proxy code in the `custom.py` file should do the following:

- Import the necessary modules and, optionally, theruntime parametersfrommodel-metadata.yaml.
- Connect the custom model to an external model via an HTTPS connection or the network protocol required by your external model.
- Request predictions and convert prediction data as necessary.

To simplify the reuse of proxy code, you can add [runtime parameters](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/custom-model-runtime-parameters.html) through your model metadata in the `model-metadata.yaml` file:

```
# model-metadata.yaml
name: runtime-parameter-example
type: inference
targetType: regression
runtimeParameterDefinitions:
- fieldName: endpoint
  type: string
  description: The name of the endpoint.
- fieldName: API_KEY
  type: credential
  description: The HTTP basic credential containing the endpoint's API key in the password field (the username field is ignored).
```

If you define runtime parameters in the model metadata, you can import them into the `custom.py` file to use in your proxy code. After importing these parameters, you can assign them to variables in your proxy code. This allows you to create a prediction request to connect to and retrieve prediction data from the external model. The following example outlines the basic structure of a `custom.py` file:

```
# custom.py
# Import modules required to make a prediction request.
import json
import ssl
import urllib.request
import pandas as pd
# Import SimpleNamespace to create an object to store runtime parameter variables.
from types import SimpleNamespace
# Import RuntimeParameters to use the runtime parameters set in the model metadata.
from datarobot_drum import RuntimeParameters

# Override the default load_model hook to read the runtime parameters.
def load_model(code_dir):
    # Assign runtime parameters to variables.
    api_key = RuntimeParameters.get("API_KEY")["password"]
    endpoint = RuntimeParameters.get("endpoint")

    # Create scoring endpoint URL.
    url = f"https://{endpoint}.example.com/score"

    # Return an object containing the variables necessary to make a prediction request.
    return SimpleNamespace(**locals())

# Write proxy code to request and convert scoring data from the external model.
def score(data, model, **kwargs):
    # Call make_remote_prediction_request.
    # Convert prediction data as necessary.

def make_remote_prediction_request(payload, url, api_key):
    # Connect to the scoring endpoint URL.
    # Request predictions from the external model.
```

## Create a proxy model

To create a custom model as a proxy for an external model, you can add a new proxy model to the [Workshop](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/index.html). A proxy model contains the proxy code you created to connect with your external model.

To add a proxy model through the Model Workshop:

1. ClickRegistry > Workshop.
2. On theWorkshoptab, click+ Add model.
3. In theAdd a modelpanel, selectProxy, and then add the model information: FieldDescriptionModel nameA descriptive name for the custom model.Target typeThe type of prediction the model makes. Depending on the prediction type, you must configure additional settings:Binary: For a binary classification model, enter thePositive class labelandNegative class label. Then, optionally, enter aPrediction threshold.Regression: No additional settings.Time Series (Binary):Preview feature. For a binary classification model, enter thePositive class labeland theNegative class labeland configure thetime series settings. Then, optionally, enter aPrediction threshold.Time Series (Regression):Preview featureConfigure thetime series settings.Multiclass: For a multiclass classification model, enter or upload (.csv,.txt) theTarget classesfor your target, one class per line. To ensure that the classes are applied correctly to your model's predictions, enter classes in the same order as your model's predicted class probabilities.Text Generation:Premium feature. No additional settings.Anomaly Detection: No additional settings.Vector Database:Preview featureNo additional settings.Location:Premium feature. No additional settings.Agentic Workflow:Premium feature. No additional settings.MCP Server:Premium feature. No additional settings. An MCP server is a tool that allows you to expose the DataRobot API as a tool that can be used by agents.Target nameThe dataset's column name that the model will predict on. This field isn't available for multiclass or anomaly detection models.Optional settingsPrediction thresholdFor binary classification models, a decimal value ranging from 0 to 1. Any prediction score exceeding this value is assigned to the positive class.LanguageThe programming language used to build the model.DescriptionA description of the model's contents and purpose.
4. After completing the fields, clickAdd model.

## Assemble a proxy model

To assemble the proxy model, bring the proxy code you created to connect with your external model into the Workshop and ensure the proxy model has network access.

1. On theAssembletab, navigate to theEnvironmentsection and select a model environment from theBase environmentdropdown menu. Model environmentsThe model environment is used fortestingand deploying the custom model. TheBase Environmentdropdown list includesdrop-in model environmentsand anycustom environmentsthat you can create. By default, the custom model uses the most recent version of the selected environment with a successful build.
2. To populate theDependenciessection, you can upload arequirements.txtfile in theFilessection, allowing DataRobot to build the optimal image.
3. In theFilessection, add the required proxy model files. If you aren't pairing the model with adrop-in environment, this includes the custom model environment requirements and astart_server.shfile. You can add files in several ways: ElementDescription1FilesDrag files into the group box for upload.2Choose from sourceClick to browse forLocal Filesor aLocal Folder. Topull files from a remote repository, use theUploadmenu.3UploadClick to browse forLocal Filesor aLocal Folderor to pull files from aremote repository.4CreateCreate a new file, empty or as a template, and save it to the custom model:Create model-metadata.yaml: Creates a basic, editable example of a runtime parameters file.Create blank file: Creates an empty file. Click the edit icon () next toUntitledto provide a file name and extension, then add your custom contents. File considerationsIf you add a new file with the same name as an existing file, when you clickSave, the old file is replaced in theFilessection. When you add files from aLocal Folder, make sure the model file is already at the root of the custom model. Uploaded folders are for dependent files and additional assets required by your model, not the model itself. Even if the model file is included in the folder, it will not be accessible to DataRobot unless the file exists at the root level. The root file can then point to the dependencies in the folder.
4. On theAssembletab, in theSettingssection, next toResources, click ()EditandsetNetwork accesstoPublic.
5. If you provided runtime parameters in the model metadata, after you build the environment and create a new version, you canconfigure those parameters in theRuntime parameterssection.
6. Finally, you canregister the custom modelto create a deployable proxy model.
