POST /chat/completions endpoint using the member’s key. Create keys, set budgets, and review spend in your gateway. The relay needs only the member keys for inference. A missing, disabled, or rejected key stops the request.
This is a rapidly evolving feature, so ask your account team for updates. It will get easier!
Prerequisites
- A working Enterprise Docker Compose installation or Helm installation using the OpenHands Runtime API, an organization with active human members, and operator access to the application container.
- An HTTPS gateway endpoint that supports OpenAI-compatible Chat Completions and is reachable directly from the OpenHands app container. The relay does not use HTTP proxy environment variables. Each sandbox must also be able to reach the OpenHands relay and token URLs.
- One restricted gateway virtual key per member. Set the models and spending limit for each key in your gateway. Use a sandbox image with the Enterprise build’s pinned agent-server and SDK versions so the sandbox can refresh its inference token.
Enable the relay on the deployment
Docker Compose
Run the commands from the Enterprise Compose directory. Set these values in the Compose.env file. Use an HTTPS hostname that routes to the OpenHands application API and that your sandbox containers can resolve and reach. In this example, app.example.com is the hostname of the Compose HTTPS reverse proxy. A private hostname is fine if it routes both paths to the application and the sandboxes trust its TLS certificate. Put your gateway’s URL in the model catalog below.
/v1. Inference tokens default to 900 seconds. If you set CUSTOMER_GATEWAY_TOKEN_TTL_SECONDS, use an integer from 1 to 3600. The overlay enables the relay on the app and worker and turns off user-managed LLM provider settings for the deployment. Organization routing starts when you enable the organization’s gateway profile.
Helm with the OpenHands Runtime API
Use a chart and Enterprise image that include the relay. The Helm qualification used chart0.114.1 with Enterprise 1.96.0 and the chart’s standard Runtime API. Verify that a normal sandbox starts before enabling per-member routing.
Add the following to your existing Helm values. Keep the current Runtime API connection and bundled LiteLLM configuration. The URLs point to the OpenHands application API ingress that your sandboxes can reach over HTTPS.
/api/customer-gateway/v1/models with
Authorization: Bearer probe. The relay returns HTTP 401 with error code invalid_token.
The sandbox uses GET on /api/customer-gateway/token to refresh its token.
The Helm validation covered web inference with two members on the OpenHands Runtime API. Test
resolver and automation paths separately if you use them on Helm.
Open an operator command session
Define these functions for your deployment. The following steps use them to run commands inside the app container.- Docker Compose
- Helm
Stage the organization and its members
1. Define the model catalog
Createcustomer-gateway.json using the LiteLLM example below. The relay appends /chat/completions to base_url. The keys in models are aliases OpenHands uses. The values must match the model names your gateway expects in requests.
credential_header set to authorization, the relay sends the member’s key as an Authorization: Bearer credential. If your gateway uses a different credential header, configure its name. The relay sends the key as the value of that header. Declare only capabilities your gateway supports. The relay builds the member’s model list from the catalog and their allowlist.
Use the OpenHands organization UUID and member user UUID. The organization members API, GET /api/organizations/{org_id}/members, lists the member identifiers.
2. Import one key per member
Key provisioning and rotation use the operator CLI in the app container. Pass the key on standard input from your secret source. If you use a file, restrict access to the operator and store only the member’s key in it.set-key for each member. The status output shows the member’s enabled state, model allowlist, key fingerprint, and credential and policy versions. To rotate a key, keep the same member UUID and repeat the current model aliases in --models. The next request uses the new key. Check that your gateway records the request against the new key before revoking the old one. Rotating a key preserves the member’s enabled or disabled state.
3. Set an organization LLM profile
For each alias you want users to select, save a new keyless organization LLM profile. An organization admin with permission to edit settings can usePOST /api/organizations/{org_id}/profiles/{name} with a body like this.
POST /api/organizations/{org_id}/profiles/{name}/activate. Activation applies the model to the
admin who activates the profile. Before enabling routing, confirm that each member’s effective
model uses openai/<alias> with an alias in their allowlist. Use the same alias format in any
agent or automation configuration that selects a model. The relay checks the member’s allowlist,
and your gateway applies its own key policy.
4. Enable routing and start fresh conversations
Verify the intended profiles and individual keys, then stop the organization’s existing sandboxes before enabling routing. The standard Compose configuration can reuse a running sandbox, and the relay requires a sandbox started after the switch.Verify attribution and access
Use two signed-in members with distinct keys in the same organization. Start a fresh conversation as each member and select a saved LLM profile with an alias in their allowlist. To select the profile explicitly, sendPOST /api/v1/app-conversations as that member in the
gateway-enabled organization. Set llm_profile to the saved profile’s name:
Test the resolver and automation paths you run in production. For a resolver, verify the repository resolves to the intended organization and your gateway records spend under the mapped actor’s key. For an automation, verify which member owns the sandbox. Service-account launches, Slack and Jira conversation triggers, and standalone SDK inference through
CloudWorkspace.get_llm() are outside this mode’s supported entry points.
Suspend a key or roll back
Usedisable to suspend one member. Subsequent inference requests are denied even if the sandbox still holds an unexpired token. Use enable with the same arguments to let that member start a new conversation.
set-org with the same gateway ID
and catalog file, adding --disable. Restore the previous organization LLM profile and confirm
its provider is configured before starting fresh conversations.
To turn the relay off for the deployment, disable routing for every gateway-enabled organization
first. Then remove the gateway overlay on Compose and recreate the app and worker. On Helm, set
env.CUSTOMER_GATEWAY_ENABLED to "false", restore the previous value of
OH_ALLOW_USER_LLM_CONFIGURATION, and apply your values. Keep the database and its application
encryption configuration together to retain access to the stored keys.
Troubleshooting
For support, collect the OpenHands version, timestamp, error code, request ID if present, and sanitized app and runtime log excerpts. Keep virtual keys and authorization headers out of the report.

