Skip to main content

Using the Workforce AI Gateway and Model Router with Agentic Development Tools

This article describes using Claude Code with the Workforce AI Security Gateway and Model Router to redirect inference requests from the Anthropic API to privately hosted Claude models on AWS Bedrock, Google Vertex AI, or Azure AI Foundry.

The Workforce AI Security Gateway and Model Router enables organizations to intercept Claude Code traffic. It redirects inference requests to private models connected to their Workforce AI Security tenant. When configured, Workforce AI Security routes Claude Code requests to a designated private model instead. Otherwise, these requests would go directly to the Anthropic API. This lets organizations apply the same governance controls used for other AI services. It also lets them apply the same policy enforcement.

This feature requires configuration in two places. The first is the Claude Code Model Router settings in the Workforce AI Security admin console. The second is the Claude Code Helper installed on each developer's machine.

Use cases

Some organizations have deployed Claude models through a cloud provider. Examples include AWS Bedrock, Google Vertex AI, and Azure AI Foundry. These organizations can use this feature to redirect Claude Code traffic to those privately hosted models. This keeps traffic off the public Anthropic API. This gives development teams access to the same Claude Code experience. It also keeps inference traffic within the organization's own cloud environment.

Two common drivers for this are data privacy and cost. Some organizations have strict data residency requirements. Some also have internal policies that restrict sending code and prompts to third-party APIs. These organizations can use the model router to ensure that inference requests stay within their controlled infrastructure. Other organizations have negotiated committed use agreements or reserved capacity with a cloud provider. They can also route Claude Code traffic through those arrangements rather than incurring separate Anthropic API costs.

Claude Code Model Router

The Claude Code Model Router is configured at the policy level. Admins can enable it on the Default Policy. They can also enable it on any Group Policy. To access the router settings, navigate to either Default Policy or Group Policies in the GOVERN section. Then scroll to the Claude Code Model Router section.

Enabling the router

The router is enabled using the toggle at the top of the Claude Code Model Router section. All three model routes must be configured. Only then can the router function correctly. The three Claude models that require a route are:

  • Claude Haiku 4.5

  • Claude Sonnet 4.6

  • Claude Opus 4.6

Each model route maps a Claude model to a private model. That private model must be available in the organization's Workforce AI Security tenant. The dropdown for each route only shows private models. These models must belong to a compatible model family. Claude Haiku 4.5 supports routing to private models from the Haiku, Sonnet, or Opus family. Claude Sonnet 4.6 and Claude Opus 4.6 each support routing to models from either the Sonnet or Opus family. Using the latest available model versions is recommended. Older models may result in failed requests or degraded outputs.

The selected private model may match the same model family as the Claude model being routed. When it does, a Recommended label appears next to the selection. This label indicates that the routing configuration meets the recommended capability equivalence.

Configuring Claude Code on developer machines

Routing Claude Code traffic through Workforce AI Security requires the Claude Code Helper. This helper must be installed on each developer's machine. The helper is a cross-platform utility distributed as a compiled, zero-dependency binary or as a Node.js script. It handles OAuth 2.0 token-based authentication. It also exports OS-trusted CA certificates so that Claude Code trusts TLS inspection. It also configures all required Claude Code settings during installation.

Claude Code Helper

By default, Claude Code authenticates directly to the Anthropic API using a static API key. Requests may instead be routed through the Workforce AI Security model router. When that happens, Claude Code must use OAuth 2.0 tokens. The organization's Workforce AI Security identity service issues these tokens. The Claude Code Helper replaces the static API key with this token-based flow. Claude Code calls the helper before each session. The helper then returns a valid bearer token. This token is sent with every model request.

The helper implements the OAuth 2.0 Device Authorization Grant flow (RFC 8628). On first use, it contacts the Workforce AI Security authorization server. It then prompts the developer to complete a one-time login in their browser. After authorization, the helper caches access and refresh tokens in the OS-native credential manager. On subsequent sessions, the helper checks the cached token. If the token is approaching expiration (past its midpoint), it proactively refreshes using the stored refresh token. This means sessions are not interrupted. A new browser-based login is only required if both tokens have expired and a final refresh attempt also fails.

Tokens are stored using the OS-native credential manager on each platform. Windows uses Windows Credential Manager, macOS uses Keychain, and Linux uses Secret Service (GNOME Keyring). Credentials are never written to disk as plain text.

The helper is available from Workforce AI Security support as either a compiled binary (no runtime dependencies) or a Node.js script. The script requires Node.js 18 or later. Organizations can distribute it to developer machines through their standard software distribution or MDM process. Alternatively, developers can install it directly using the built-in install command.

Prerequisites

The Claude Code Helper requires one of the following:

  • Node.js script (claude-code-helper.js): Node.js 18 or later

  • Compiled binary: No runtime dependencies; available for Windows, macOS (x64 and ARM64), and Linux (x64 and ARM64)

On Linux, the secret-tool utility must also be installed for credential storage. It is included in the libsecret-tools package:

  • Debian / Ubuntu:sudo apt install libsecret-tools

  • Fedora:sudo dnf install libsecret

  • Arch:sudo pacman -S libsecret

Installing the helper

The helper includes a built-in install command that copies it to a standard location. It also automatically configures ~/.claude/settings.json:

node claude-code-helper.js -i

The install command:

  • Copies the helper to ~/.surepath/claude-code-helper/bin/

  • Writes the following settings to ~/.claude/settings.json, preserving all existing settings:

    • apiKeyHelper — set to the installed helper path

    • env.ANTHROPIC_BASE_URL — set to https://gateway.surepath.ai

    • env.NODE_EXTRA_CA_CERTS — set to ~/.surepath/claude-code-helper/certs/extra-ca-certs.pem

    • hooks.SessionStart — appends the helper's certificate export command; existing hooks from other tools are preserved

    • permissions.deny — appends "WebSearch" and "ToolSearch" to block these tools. Both are incompatible with non-Anthropic API providers routed through the gateway. Existing allow rules and other deny entries are preserved.

  • Backs up the existing ~/.claude/settings.json before writing

  • Removes any legacy installation directories from earlier versions

To proceed without confirmation prompts, add the --yes flag (short form -y):

node claude-code-helper.js -i --yes

Conflict detection

Before installing, the helper checks for environment variables. It looks for variables that would prevent correct routing through the Workforce AI Security Gateway. If conflicting variables are detected, installation is aborted and the conflicts are listed. Blocked variables include:

  • Backend bypass flags: CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, CLAUDE_CODE_USE_FOUNDRY — these disable ANTHROPIC_BASE_URL routing

  • Provider-specific URLs: variables prefixed with ANTHROPIC_AWS_*, ANTHROPIC_BEDROCK_*, ANTHROPIC_VERTEX_*, ANTHROPIC_GCP_*, or ANTHROPIC_FOUNDRY_*

  • Auth interference: ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN — these send incorrect credentials to the Workforce AI Security endpoint

To automatically disable detected conflicts, use the --force flag:

node claude-code-helper.js -i --force

This renames each conflicting variable by prefixing it with SP_DISABLE_ in the settings file where it was found. Variables set in the shell environment (not in a settings file) cannot be renamed automatically. A warning is shown with instructions to unset them manually.

To see a full diagnostic of all detected configuration issues without making changes:

node claude-code-helper.js --report

The report includes a Permissions Audit section that checks runtime directory ownership and file permissions. This section is particularly useful for diagnosing issues in MDM-deployed environments.

For fully unattended installation (useful in scripts or provisioning workflows):

node claude-code-helper.js -i --force --yes

Uninstalling

To remove the helper and revert Claude Code settings:

node claude-code-helper.js -u

The uninstall command removes the installed helper and stored credentials from the OS credential manager. It surgically reverts only the settings keys that were written during install. User-added allow rules, other deny entries, and all other env and hooks settings are preserved. Log files, backup files, and the CA certificate file are retained. A timestamped backup of settings.json is created before any changes are made.

Clearing credentials

To delete stored credentials — access token, refresh token, and cached auth URL — without performing a full uninstall:

node claude-code-helper.js --clear-credentials

This forces re-authentication on the next Claude Code session. It preserves the installation, settings, and CA certificates in the process. Useful for troubleshooting authentication issues or switching tenant accounts. The short alias is -cc.

Collecting diagnostic logs

To generate a support bundle containing logs, configuration, and a diagnostic report, run:

node claude-code-helper.js --collect-logs

The short alias is -cl.

The command creates a zip file on the desktop. The zip file contains filtered log files, the current --report output, and configuration details. Binary files and credentials are excluded. The bundle is suitable for sharing with Workforce AI Security support. Each file in the zip is capped at 10 MB.

Fixing permission errors

A permission error when writing certificates or credentials can occur after MDM deployment. This happens when runtime directories were created by an administrator account. If the helper reports this error, run the fix-permissions command with elevated privileges.

macOS / Linux:

sudo node claude-code-helper.js --fix-permissions

Windows (run as Administrator):

node claude-code-helper.js --fix-permissions

The short alias is -fp.

This command scans the affected directories, confirms the changes, and corrects ownership. As a result, the current user can write to the required paths.

The --install, --uninstall, --upgrade, --cert-only, --clear-credentials, and --api-key commands are blocked when run as root or Administrator. Run those commands as the target user. Use --fix-permissions with elevation only for the repair step.

CA certificate export

The helper automatically exports OS-trusted CA certificates to ~/.surepath/claude-code-helper/certs/extra-ca-certs.pem at the start of each session via the SessionStart hook. The NODE_EXTRA_CA_CERTS environment variable is set to this path. This lets Claude Code trust certificates installed at the OS level. This includes the Workforce AI Security CA certificate required for TLS inspection.

The export result is cached for 24 hours. To force a refresh before the cache expires:

node claude-code-helper.js --session-start --update-certs

Some organizations handle authentication separately. If they only need the CA certificate configured, they can use cert-only mode:

node claude-code-helper.js --cert-only

This writes only env.NODE_EXTRA_CA_CERTS to ~/.claude/settings.json and leaves all other settings untouched. The short alias is -co.

Settings file location

Claude Code reads its configuration from settings.json in the .claude directory of the user's home folder. The path varies by operating system:

  • macOS:~/.claude/settings.json (expands to /Users/<username>/.claude/settings.json)

  • Linux:~/.claude/settings.json (expands to /home/<username>/.claude/settings.json)

  • Windows:C:\Users\<username>\.claude\settings.json

Required configuration

The following settings are written to ~/.claude/settings.json by the install command:

{  "apiKeyHelper": "node ~/.surepath/claude-code-helper/bin/claude-code-helper.js --api-key",  "env": {    "ANTHROPIC_BASE_URL": "https://gateway.surepath.ai",    "NODE_EXTRA_CA_CERTS": "~/.surepath/claude-code-helper/certs/extra-ca-certs.pem"  },  "hooks": {    "SessionStart": [      {        "hooks": [{ "type": "command", "command": "node ~/.surepath/claude-code-helper/bin/claude-code-helper.js --session-start" }]      }    ]  },  "permissions": {    "deny": ["WebSearch", "ToolSearch"]  }}

All writes are surgical. Only the specific keys listed above are added or updated. Existing settings are preserved.

Windows configuration

On Windows, paths must use backslash notation with each backslash escaped as \\ in JSON:

{  "apiKeyHelper": "node \"C:\\Users\\<username>\\.surepath\\claude-code-helper\\bin\\claude-code-helper.js\" --api-key",  "env": {    "ANTHROPIC_BASE_URL": "https://gateway.surepath.ai",    "NODE_EXTRA_CA_CERTS": "C:\\Users\\<username>\\.surepath\\claude-code-helper\\certs\\extra-ca-certs.pem"  }}

The helper runs via Node.js on all platforms. No additional shell environment such as Git Bash or WSL is required on Windows.

macOS PKG installer

For macOS deployments, Workforce AI Security provides pre-built .pkg installer packages. These support both Apple Silicon (ARM64) and Intel (x64) architectures. The installer filenames follow the pattern:

  • claude-code-helper-<version>-macos-arm64.pkg

  • claude-code-helper-<version>-macos-x64.pkg

Each PKG installs two files to /Library/Application Support/ClaudeCode/:

File

Install path

Purpose

Binary

/Library/Application Support/ClaudeCode/surepath/bin/claude-code-helper-macos-<arch>

The compiled helper binary

Configuration

/Library/Application Support/ClaudeCode/managed-settings.json

Default managed settings for Claude Code

The installer automatically:

  • Sets the binary as executable (chmod 755)

  • Removes the com.apple.quarantine extended attribute from the binary

  • Sets appropriate permissions on managed-settings.json (chmod 644)

This eliminates the need for MDM admins to include separate post-install scripts for permission or quarantine handling. The PKG handles both automatically during installation.

The installer displays as "Workforce AI Security - Claude Code Helper" in the macOS Installer UI. It requires administrator privileges. It installs to the local system domain only (not user home directories).

Code signing and notarization

The macOS binaries and PKG installers distributed by Workforce AI Security are fully signed. They are also notarized for enterprise deployment.

Binary signing: Each macOS binary is signed with a Developer ID Application certificate. It also includes a hardened runtime entitlement. This satisfies macOS Gatekeeper requirements. It also allows the binary to execute without security warnings or manual approval on managed devices.

PKG signing: Each .pkg installer is signed with a Developer ID Installer certificate. MDM platforms such as JAMF, Mosyle, and Kandji can deploy signed PKGs without triggering Gatekeeper blocks. No user intervention is required.

Apple Notarization: Both the signed binaries and the signed PKGs are submitted to Apple's notarization service. After successful notarization, the notarization ticket is stapled to each PKG. This allows offline Gatekeeper verification. The device does not need to contact Apple's servers at install time. This still lets it confirm the package is trusted.

The PKGs are signed and notarized. Because of this, the com.apple.quarantine extended attribute and Gatekeeper blocks described in the manual deployment section do not apply. This is true when using the PKG installer. These issues only affect binaries that are manually downloaded. They also affect binaries deployed outside of a signed package.

To verify the signing and notarization status of a PKG:

pkgutil --check-signature /path/to/claude-code-helper-<version>-macos-<arch>.pkg

To verify Gatekeeper approval:

spctl -a -t install -vv /path/to/claude-code-helper-<version>-macos-<arch>.pkg

Distributing configuration via MDM

For enterprise or fleet-wide deployments, the recommended approach is to use a managed-settings.json file. Deploy it alongside the helper binary or script. Claude Code reads this file at startup. It treats the file's values as organization-level defaults. These defaults cannot be overridden by individual user settings.

To deploy via MDM:

  • Deploy the helper binary or script to a system-wide directory on each managed machine:

    • Windows:C:\Program Files\ClaudeCode\surepath\bin\

    • macOS:/Library/Application Support/ClaudeCode/surepath/bin/

    • Linux:/opt/surepath/bin/

  • Deploy the matching managed-settings.json to the Claude Code managed settings directory:

    • Windows:C:\Program Files\ClaudeCode\

    • macOS:/Library/Application Support/ClaudeCode/

    • Linux:/etc/claude-code/

  • Developers launch Claude Code. Authentication and CA certificate export happen automatically on first session start.

Pre-built managed-settings.json files for each supported platform and distribution format are available from Workforce AI Security support.

Customizing managed settings (macOS)

The macOS PKG installer includes a default managed-settings.json. This file is pre-configured for the standard Workforce AI Security gateway deployment. This default configuration is suitable for most organizations.

Admins may need to customize the managed settings. For example, they might modify permissions, change environment variables, add additional hooks, or point to a different gateway URL. In that case, they have two options:

Option 1: Modify after PKG installation

Install the standard PKG. Then deploy a customized managed-settings.json to /Library/Application Support/ClaudeCode/ using a separate MDM policy. For example, use a JAMF "Copy File" payload or a post-install script. This overwrites the default settings file delivered by the PKG. The signed, notarized binary stays in place.

Option 2: Build a custom PKG

Use the standalone signed binary from the build artifacts along with a custom managed-settings.json to create a custom PKG. The build artifacts are available separately from Workforce AI Security support. Build it using macOS pkgbuild and productbuild. Example managed-settings.json templates for each platform and architecture are included in the release artifacts under the examples/managed-settings/ directory.

In both cases, the managed-settings.json file must use absolute system paths. The ~ shortcut and %USERPROFILE% expansion are not supported. Refer to the platform-specific example files for the correct path format.

Setting executable permissions on macOS and Linux

Note: If deploying via the macOS PKG installer, the steps in this section are handled automatically. The package's post-install script handles them. The following guidance applies only when deploying the binary manually (outside of a PKG).

On macOS and Linux, the helper binary must have its executable bit set. Claude Code cannot run it otherwise. MDM deployment tools — including Jamf, Intune, and similar platforms — typically do not preserve POSIX file permissions. This applies when copying or downloading files to managed machines. The binary arrives on the device with default permissions. Those permissions do not include the executable bit. This happens even if the source file was executable.

If the executable bit is not set, Claude Code will fail to call the helper. This failure happens at session start. The apiKeyHelper call and the SessionStart hook will both return a Permission denied error. As a result, developers will be unable to authenticate. This failure is often reported to the developer as an API key or authentication error. There is no obvious indication that the root cause is a file permission issue.

To prevent this, include a chmod command as part of the MDM post-install script or package configuration. Run it immediately after the binary is deployed:

chmod 755 /Library/Application\ Support/ClaudeCode/surepath/bin/claude-code-helper-macos-arm64
chmod 755 /opt/surepath/bin/claude-code-helper-macos-arm64

Running chmod in the post-install step ensures the permission is set automatically on every managed machine. This removes the need for manual intervention.

To verify the permission is correctly set on a device, run:

ls -l /path/to/claude-code-helper

The output should show -rwxr-xr-x at the start of the line. If it shows -rw-r--r-- or similar without the x bits, the binary is not executable.

macOS quarantine attribute

On macOS, a binary may be downloaded from the internet rather than deployed through a signed package. In that case, it may also carry a quarantine extended attribute (com.apple.quarantine). Gatekeeper uses this attribute to block execution. This is separate from file permissions. To check for and remove the attribute:

xattr -l /Library/Application\ Support/ClaudeCode/surepath/bin/claude-code-helper-macos-arm64xattr -d com.apple.quarantine /Library/Application\ Support/ClaudeCode/surepath/bin/claude-code-helper-macos-arm64

Binaries deployed via the Workforce AI Security signed and notarized PKG installer do not receive this attribute. Their executable bit is set automatically. The PKG installer is the recommended deployment method for macOS.

Alternatively, the helper may already be distributed to developer machines. In that case, individual developers can run the install command (node claude-code-helper.js -i) themselves. This configures their own ~/.claude/settings.json automatically.

Paths in managed-settings.json must be absolute system-wide paths. The ~ shortcut and %USERPROFILE% expansion are not supported.

Did this answer your question?