Connect model clients to the gateway
Choose the instructions for your model client and credential. Start with a running gateway and an application that allows proxy traffic.
Connect a model client
For an application with approved Model controls, authenticate the native client with the registered workload’s short-lived model.access token in Authorization: Bearer. Follow the workload token steps. Use the gateway address and the native path for the selected route:
| Provider route | Native request path |
|---|---|
| OpenAI Responses | /v1/responses |
| Azure OpenAI Responses | /openai/v1/responses, with model set to the selected Azure deployment name |
| Anthropic Messages | /v1/messages, with the saved anthropic-version |
| Amazon Bedrock Messages | /anthropic/v1/messages, with model anthropic.claude-haiku-4-5 and anthropic-version: 2023-06-01 |
| OpenAI-compatible Chat Completions | /v1/chat/completions |
| Google Vertex AI | /v1beta1/projects/<project>/locations/us/publishers/google/models/<model>:generateContent, or :streamGenerateContent?alt=sse for streaming |
Use the exact configured model, project where applicable, response profile, and limits. The gateway checks a completed response before returning JSON or buffered streaming events. The source package’s samples/gateway-models clients show the request shapes for their configured profiles.
For Azure OpenAI, complete the Azure connection and host identity setup, then set the OpenAI SDK’s base URL to your gateway followed by /openai/v1/. Using getToken() from the linked workload token procedure, configure the client as follows:
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://YOUR_GATEWAY/openai/v1/',
apiKey: await getToken(),
maxRetries: 0,
});The SDK’s apiKey option receives the registered VeriProof workload’s Bearer token. Keep the workload token helper available to refresh it. Set each request’s model to the exact deployment selected in Model controls. Azure provider credentials stay on the gateway host.
Amazon Bedrock Messages with Claude Code
Complete the Bedrock connection and host identity setup, save and approve the application settings, and register the workload. Use a gateway release qualified for this profile. Claude Code connects to the gateway, using its Mantle provider selection:
| Setting | Value |
|---|---|
CLAUDE_CODE_USE_MANTLE | 1 |
CLAUDE_CODE_SKIP_MANTLE_AUTH | 1 |
ANTHROPIC_BEDROCK_MANTLE_BASE_URL | https://YOUR_GATEWAY/anthropic |
AWS_REGION | us-east-1 |
ANTHROPIC_AUTH_TOKEN | Registered workload’s short-lived model.access token |
--model | anthropic.claude-haiku-4-5 |
Claude Code appends /v1/messages to that base URL. Keep AWS credentials on the gateway host. Use the workload token as the Bearer credential; do not configure ANTHROPIC_API_KEY, AWS_BEARER_TOKEN_BEDROCK, or an apiKeyHelper for this connection.
To obtain a fresh token without printing it or putting it in command arguments, create a Node launcher at the source package root. Copy the JavaScript token-provider setup from Request a workload token, replacing its final await getToken() and console.log lines with the following. Set the executable and configuration paths for your host; use a separate, private Claude configuration directory for this gateway.
import { spawn } from 'node:child_process';
const env = {};
for (const name of ['PATH', 'SystemRoot', 'WINDIR', 'COMSPEC', 'HOME', 'USERPROFILE',
'APPDATA', 'LOCALAPPDATA', 'TEMP', 'TMP', 'CLAUDE_CODE_GIT_BASH_PATH']) {
if (process.env[name]) env[name] = process.env[name];
}
Object.assign(env, {
CLAUDE_CONFIG_DIR: '/path/to/private/claude-gateway-config',
CLAUDE_CODE_USE_MANTLE: '1',
CLAUDE_CODE_SKIP_MANTLE_AUTH: '1',
ANTHROPIC_BEDROCK_MANTLE_BASE_URL: 'https://YOUR_GATEWAY/anthropic',
AWS_REGION: 'us-east-1',
ANTHROPIC_AUTH_TOKEN: await getToken(),
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',
});
const child = spawn('/path/to/claude', [
'--setting-sources', '', '--no-session-persistence',
'--model', 'anthropic.claude-haiku-4-5', ...process.argv.slice(2),
], { env, stdio: 'inherit', shell: false });
delete env.ANTHROPIC_AUTH_TOKEN;
child.on('error', () => { process.exitCode = 1; });
child.on('exit', code => { process.exitCode = code ?? 1; });Save it as claude-gateway.mjs at the source package root. On Windows, use the full claude.exe path and a Windows configuration directory. Run it from the project directory you want Claude Code to work in, for example:
node /path/to/source-package/claude-gateway.mjs --print --max-turns 2 "Summarize the current project."The launcher obtains one short-lived token for that run. Run it again for a fresh token when starting another session or after authentication expires. Keep Claude Code’s tool permissions enabled and approve only the local actions needed for your task.
API-key OpenAI text route
Use this separate path when the application has an ordinary OpenAI text route without native Model controls. Set the client’s base URL to the gateway address followed by /v1, for example http://127.0.0.1:7080/v1 for an agent on the same host. For connections outside the local host or shared container network, use the deployment’s TLS address and network access policy.
Use the application-secret segment of the complete VeriProof API key as the key this client sends. The complete key has three segments; the application secret is the last segment. The gateway host uses the complete API key for its connection to VeriProof. This API-key client sends only the application secret in Authorization: Bearer; the workload-token path above does not accept it as a fallback. Never put the OpenAI provider key in the client or send both Bearer and X-API-Key authentication.
The JSON-only profile openai-responses-text-json-v1 accepts a request with these fields:
| Field | Value |
|---|---|
model | An exact identifier from Approved model identifiers |
input | A nonempty text string |
instructions | Optional text string |
store | Required, false |
max_output_tokens | Required whole number from 1 to the saved Maximum output tokens |
stream | Omit it or set it to false |
Use text messages for this JSON-only profile. Tools, structured-output settings, media, conversation references, background work, and streaming aren’t accepted. Remove extra client options and routing headers. Disable automatic client retries; the gateway makes one upstream attempt for each request.
Send an API-key JSON test request
Run this Bash example from the agent’s network location. Have your secret store supply GATEWAY_APPLICATION_SECRET; don’t paste the secret into a command or source file. Set GATEWAY_MODEL_ID to an exact identifier saved for this application. The saved output-token limit must be at least 128 for this example.
export GATEWAY_BASE_URL='http://127.0.0.1:7080/v1'
export GATEWAY_MODEL_ID='YOUR_APPROVED_MODEL_ID'
: "${GATEWAY_APPLICATION_SECRET:?Load the gateway application secret from your secret store}"
curl --silent --show-error --include --retry 0 \
--request POST "${GATEWAY_BASE_URL}/responses" \
--header "Authorization: Bearer ${GATEWAY_APPLICATION_SECRET}" \
--header 'Content-Type: application/json' \
--data-binary @- <<JSON
{
"model": "${GATEWAY_MODEL_ID}",
"input": "Reply with the word ready.",
"max_output_tokens": 128,
"store": false,
"stream": false
}
JSONA completed request returns the provider’s native Responses JSON after the gateway permits the output. Inspect status and the output messages. With Capture evidence active, you can also review the request in Gateway activity. For a gateway rejection, read error.code and use the recovery guide.