AI Provider Admin Controls

Workbench | Preview

WarningPreview feature

This feature is in preview. Preview features are unsupported and may face breaking changes in a future release. Any issues found in the feature will be addressed during the regular release schedule; they will not result in immediate patches or hotfixes.

We encourage customers to try these features and we welcome any feedback via Posit Support, but we recommend that the feature not be used in production until it is in general availability (i.e., officially released as a full feature). To provide feedback, please email your Posit Customer Success representative or and specify that you are trialing this feature.

You can define two settings in /etc/rstudio/profiles to supply an AI-provider configuration for your users. Both point at a JSON file in the providers.json schema, and Posit Workbench resolves each per user at session launch and applies it to RStudio Pro and Positron Pro sessions.

Setting Effect
ai-providers-enforced Constrains the AI providers and models available. Users cannot override it.
ai-providers-default Supplies a starting configuration. Users can override it in their own providers.json.

The two are separate channels and resolve independently. Posit Assistant applies the default configuration first and the enforced configuration last, so setting both gives your users a working starting point plus the constraints they cannot escape. Neither setting is required, and setting one does not imply the other.

Like other profile settings, both are scoped using global ([*]), per-group ([@groupname]), and per-user ([username]) sections. See User and Group Profiles for the full profiles syntax, including which section applies when more than one matches a user.

ai-providers-enforced

Property Value
Type path to a JSON file (in the providers.json schema)
Default unset (no enforced configuration)

Path to a JSON file that supplies the AI-provider configuration. Workbench resolves this setting per user at session launch and forwards the file’s contents to the session as a providers.json-schema configuration. Use this setting to constrain which AI providers and models are available. You can also supply provider connection settings, configure provider discovery, and define custom providers.

Path resolution for ai-providers-enforced mirrors positron-enforced-settings. A relative path resolves against the directory that contains the profiles file (/etc/rstudio/ by default). Workbench uses an absolute path as-is.

Set globally, one configuration governs every user:

/etc/rstudio/profiles
[*]
ai-providers-enforced = /etc/rstudio/ai-providers-enforced/global.json

To vary the configuration by group or by user, see Sections and precedence.

ai-providers-default

Property Value
Type path to a JSON file (in the providers.json schema)
Default unset (no default configuration)

Path to a JSON file that supplies a starting AI-provider configuration. Workbench resolves this setting per user at session launch and forwards the file’s contents to the session, unmodified. Use it to give users a working configuration out of the box (a pre-configured internal gateway, a preferred model) without preventing them from changing it.

Path resolution is identical to ai-providers-enforced: a relative path resolves against the directory that contains the profiles file (/etc/rstudio/ by default), and Workbench uses an absolute path as-is.

/etc/rstudio/profiles
[*]
ai-providers-default = /etc/rstudio/ai-providers-default/global.json

How it interacts with the other settings

Three sources can configure a provider. Posit Assistant applies them in this order, each overriding the one before it:

  1. ai-providers-default, from this setting.
  2. The user’s own ~/.posit/ai/providers.json.
  3. ai-providers-enforced, which overrides both.

So a user can override anything ai-providers-default sets, and nothing they do overrides ai-providers-enforced. Setting the same field in both admin settings is not a conflict. The default one is what the user starts from, and the enforced one is what they end up with.

Sections and precedence

Like all profile settings, ai-providers-enforced and ai-providers-default are set within sections that target users by scope:

Section Applies to
[*] All users
[@groupname] Members of the named group
[username] A single user

If more than one section that matches a user sets ai-providers-enforced, Workbench uses the value from only one of them, chosen by Section precedence. The example below orders sections from broadest to narrowest, which gives the same result under either precedence rule.

Additionally, Workbench processes each setting separately: a section that sets only one of the two leaves the other setting’s value from earlier sections in effect.

/etc/rstudio/profiles
[*]
ai-providers-enforced = /etc/rstudio/ai-providers-enforced/global.json
ai-providers-default = /etc/rstudio/ai-providers-default/global.json

[@data-scientists]
ai-providers-enforced = /etc/rstudio/ai-providers-enforced/data-scientists.json

[jsmith]
ai-providers-enforced = /etc/rstudio/ai-providers-enforced/jsmith.json

In this example, for ai-providers-enforced, a user in no listed group gets ai-providers-enforced/global.json, a data-scientists member gets data-scientists.json, and jsmith gets jsmith.json even when also in data-scientists. If a user matches several [@groupname] sections, the last one in the file wins.

For ai-providers-default, every user gets ai-providers-default/global.json, including jsmith. Workbench processes each setting individually, which is why jsmith gets jsmith.json as their enforced file but ai-providers-default/global.json as their defaults.

Because Workbench uses the replacing file whole, a later matching section drops every setting the earlier file made rather than adding to it. Workbench logs each such replacement to rserver.log, naming both files, so this is visible when a group-level restriction unexpectedly stops applying.

The providers.json schema

The file that ai-providers-enforced or ai-providers-default points to must follow the providers.json schema. See the providers.json configuration guide for an overview of the file with common configuration examples. The file is a JSON object with a top-level providers object that contains one entry per provider ID:

/etc/rstudio/ai-providers-enforced/global.json
{
  "providers": {
    "anthropic": { "enabled": true },
    "openai": { "enabled": false }
  }
}

Provider IDs

The providers object takes one entry per provider you want to configure, named for the provider’s ID. The recognized IDs are anthropic, openai, openai-compatible, gemini, google-vertex, bedrock, snowflake-cortex, databricks, ms-foundry, copilot, positai, deepseek, ollama, lmstudio, and openrouter.

The object also takes two entries that are not providers. The default entry supplies a fallback for providers not named explicitly, and accepts only enabled. The custom entry holds your own provider definitions, each under a name you choose.

Amazon Bedrock, Snowflake Cortex, and Microsoft Foundry can use Workbench-managed credentials. See Provider setup prerequisites.

Provider fields

All fields are optional. An omitted field imposes no constraint.

Field Type Description
enabled boolean Whether the provider is available to users
baseUrl string Overrides the provider’s default API base URL
customHeaders object Additional HTTP headers sent with each request to the provider
models object Constrains and augments the models offered for the provider (see Model fields)
endpoint string Endpoint URL for a self-hosted provider such as Ollama or LM Studio. Use baseUrl for hosted providers
endpoints object Base URL overrides, one entry per protocol value (see the protocol field), for when every model on one protocol shares a path the provider’s other models do not
protocol string The provider’s API wire protocol: anthropic-messages, openai-chat, openai-responses, mlflow-responses, bedrock-converse, or google-generative. Set this only when the provider does not use its default

Model fields

The models object on a provider entry (for example providers.anthropic.models) accepts:

Field Type Description
allow array of strings Restrict the models offered for the provider to these exact model IDs
deny array of strings Block these exact model IDs
discovery "auto" or "off" Whether to auto-discover the provider’s models. Set to "off" when supplying a fixed model list through models.custom
custom array of objects Define custom model entries. Each requires at least id, name, maxContextLength, supportsTools, supportsImages, supportsToolResultImages, and supportsWebSearch
overrides object Metadata patches for models the provider already returns, one entry per model ID. Only the fields you set change. See the providers.json settings reference for the fields an entry accepts

Provider-specific credentials

Some providers take an additional object that carries connection or credential settings.

Provider Object Fields
bedrock aws profile, region
google-vertex googleCloud project, location
snowflake-cortex snowflake account, host, home, connectionName
databricks databricks host (the workspace host, not a chat base URL)

Example

The following configuration disables all providers except two: one with a restricted model list, and one with a custom base URL and connection headers:

/etc/rstudio/ai-providers-enforced/global.json
{
  "providers": {
    "default": { "enabled": false },
    "anthropic": {
      "enabled": true,
      "models": {
        "allow": ["claude-sonnet-4-5", "claude-opus-4-1"]
      }
    },
    "openai-compatible": {
      "enabled": true,
      "baseUrl": "https://llm.internal.example.com/v1",
      "customHeaders": {
        "X-Org-Id": "research"
      }
    }
  }
}

Provider setup prerequisites

Amazon Bedrock, Snowflake Cortex, and Microsoft Foundry support Workbench-managed credentials for centrally preconfigured provider access. Workbench authenticates on behalf of users, and users cannot override those credentials. For providers that do not use Workbench-managed credentials, users supply any credentials required by the provider. See the provider-specific setup instructions for the required Workbench configuration.

Amazon Bedrock

To set up Amazon Bedrock with Posit Assistant:

  1. Configure AWS Credentials for Workbench, if not already configured.
  2. Configure AWS Identity and Access Management (IAM) for Amazon Bedrock policies to allow access to Bedrock models.
  3. Enable the bedrock provider and constrain its available models through ai-providers-enforced. Supply the AWS profile and region through the provider’s aws object.

Snowflake Cortex

To set up Snowflake Cortex with Posit Assistant:

  1. Integrate Workbench with Snowflake.
  2. Configure Snowflake access to Snowflake Cortex.
  3. Enable the snowflake-cortex provider and constrain its available models through ai-providers-enforced. Supply the connection settings through the provider’s snowflake object.

Microsoft Foundry (Positron Pro)

Microsoft Foundry provides access to AI models, including Azure OpenAI models. In Positron Pro, Posit Assistant uses Workbench delegated Azure credentials with Entra ID to authenticate. The Workbench extension inside the session obtains those credentials and passes them to Posit Assistant. As a result, set the endpoint through Positron Pro settings.

Note

RStudio Pro sessions do not support delegated Azure credentials with Microsoft Foundry.

To set up Microsoft Foundry with Posit Assistant:

  1. Configure delegated Azure credentials for Workbench, if not already configured.

  2. Set the Microsoft Foundry endpoint to the Azure resource endpoint URL (for example, https://my-resource.openai.azure.com or https://my-resource.services.ai.azure.com):

    /etc/rstudio/positron-user-settings.json
    {
      "posit.workbench.foundry.endpoint": "https://my-resource.services.ai.azure.com"
    }

    You can also set this through Positron Enforced Settings:

    /etc/rstudio/enforced-settings.json
    {
      "posit.workbench.foundry.endpoint": "https://my-resource.services.ai.azure.com"
    }
  3. If a gateway fronts Foundry with its own Entra ID app registration, set posit.workbench.foundry.audience to the gateway app’s identifier. The default is https://cognitiveservices.azure.com/ for direct-to-Foundry deployments:

    /etc/rstudio/positron-user-settings.json
    {
      "posit.workbench.foundry.endpoint": "https://my-gateway.example.com",
      "posit.workbench.foundry.audience": "api://example-gateway-app-id"
    }
  4. Enable the ms-foundry provider through ai-providers-enforced.

By default, Microsoft Foundry uses model-router for server-side model selection. If you are not using model-router, turn off model discovery and declare the available models with the provider’s models.custom list in the file that ai-providers-enforced references:

/etc/rstudio/ai-providers-enforced/global.json
{
  "providers": {
    "ms-foundry": {
      "enabled": true,
      "models": {
        "discovery": "off",
        "custom": [
          {
            "id": "gpt-4o",
            "name": "GPT-4o",
            "maxContextLength": 128000,
            "supportsTools": true,
            "supportsImages": true,
            "supportsToolResultImages": false,
            "supportsWebSearch": false
          }
        ]
      }
    }
  }
}

Posit Connect AI Gateway

The Connect AI Gateway lets Posit Assistant send model requests through your Connect server. The Connect provider is experimental in Posit Assistant.

To turn on experimental features in Posit Assistant for all users, set experimentalFeatures as an assistant enforced setting:

/etc/rstudio/assistant/enforced.json
{
  "features": {
    "experimentalFeatures": true
  }
}

Turn on the gateway

You can set up the gateway in one of two ways.

Option 1: Users sign in to Connect

Use this option if you do not use Connect identity federation. In the file that ai-providers-default or ai-providers-enforced references, turn on the posit-connect provider and set baseUrl to your Connect server’s address:

/etc/rstudio/ai-providers-enforced/global.json
{
  "providers": {
    "posit-connect": {
      "enabled": true,
      "baseUrl": "https://connect.example.com"
    }
  }
}

After starting a session, each user must sign in to Connect from Posit Assistant.

Option 2: Connect identity federation

To sign users in to Connect automatically, use identity federation:

  1. Set up identity federation between Workbench and Connect. See Integrate Workbench with Posit Connect.

  2. Set the ai-providers-posit-connect-gateway-required profile setting to 1:

    /etc/rstudio/profiles
    [*]
    ai-providers-posit-connect-gateway-required=1

With this setting, Workbench turns on the posit-connect provider, points it at your Connect server, and turns off every provider that you have not explicitly named in ai-providers-enforced. When you turn on this integration, Posit Assistant signs users in to the Connect AI Gateway automatically.

Connect integrations and available models

Posit Assistant does not have its own list of models. Instead, it builds the model list from the OAuth integrations on your Connect server. Connect supports Anthropic and Amazon Bedrock integrations. For Bedrock, the integration’s IAM role must allow bedrock:ListInferenceProfiles and bedrock:ListFoundationModels so Posit Assistant can list models, and bedrock-mantle:ListModels and bedrock-mantle:CreateInference to use OpenAI models. Connect never gives users the credentials stored in an integration. Instead, Posit Assistant authenticates to the gateway with a short-lived token.

The access control model in Connect supports different configurations. The following configurations are straightforward to maintain:

  1. Add a single API key to an integration in Connect and share the integration with all users. Users never see the key, and Connect can enforce usage limits per user through the gateway.
  2. Add each user’s API key to a user-scoped integration in Connect that only that user can access.

See access control lists to learn how integrations work and how to share them.

Important

Each user must have access to at least one integration in Connect. A user with no integration does not see any Connect models in Posit Assistant after signing in.

Request metadata

Posit Assistant sends these fields to Connect in the Gateway-Metadata header on chat requests, so Connect can attribute usage to a session:

Field Value
workbench-session-id The Workbench session ID
workbench-session-name The session name shown on the Workbench home page

To add your own labels, add a Gateway-Metadata header to the posit-connect block in the file that ai-providers-enforced references. To vary the labels by group or user, scope that file in /etc/rstudio/profiles:

/etc/rstudio/ai-providers-enforced/global.json
{
  "providers": {
    "posit-connect": {
      "enabled": true,
      "baseUrl": "https://connect.example.com",
      "customHeaders": { "Gateway-Metadata": "team=analytics" }
    }
  }
}

Metadata headers follow these rules:

  • Separate multiple key=value labels with commas.
  • Keys can use up to 32 lowercase letters, digits, and hyphens, and can’t start with a hyphen.
  • Keys starting with workbench- are reserved for the session fields above.
  • Each key can appear only once.
  • Values must be printable ASCII. Percent-encode other characters, for example site=caf%C3%A9.
  • Values can’t be empty or longer than 512 bytes.
  • Connect accepts at most 16 entries and 4096 bytes in this header, including the session fields.

Workbench drops any entry that breaks these rules and logs a warning in the rserver log.

Applying changes

After editing /etc/rstudio/profiles or any file it references, reload Workbench to apply the changes:

Terminal
sudo rstudio-server reload

You do not need a full restart. Reloading re-reads the entire profiles file and any file that ai-providers-enforced or ai-providers-default references. Sessions launched after the reload use the updated settings. Running sessions keep their launch-time configuration. If Workbench cannot read the referenced file or the file contains invalid JSON, Workbench rejects the reload and keeps the previously loaded configuration. See Reloading configuration values for more about the reload command.

Helm chart configuration

On Kubernetes deployments that use the Workbench Helm chart, there is no host filesystem to place these files on. Supply both the profiles setting and the JSON file itself through config.server in values.yaml. Add each JSON file as its own config.server entry, then point the setting at it from config.server.profiles:

values.yaml
config:
  server:
    ai-providers-enforced.json: |
      {
        "providers": {
          "anthropic": { "enabled": true },
          "openai": { "enabled": false }
        }
      }
    ai-providers-default.json: |
      {
        "providers": {
          "anthropic": { "enabled": true }
        }
      }
    profiles:
      "*":
        ai-providers-enforced: ai-providers-enforced.json
        ai-providers-default: ai-providers-default.json

The chart mounts every config.server entry into the same server configuration directory, so both JSON files land alongside the rendered profiles file. Referencing them with relative paths (rather than absolute ones) lets each setting resolve against that directory automatically, without hard-coding the chart’s mount path.

See the Configuration files section of the Helm chart README for how config.server entries map to files on disk and how config.server.profiles maps to /etc/rstudio/profiles.

Back to top