Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maxamillion/177a36f959911900e6f2a1f625cdcc3a to your computer and use it in GitHub Desktop.

Select an option

Save maxamillion/177a36f959911900e6f2a1f625cdcc3a to your computer and use it in GitHub Desktop.
Red Hat: OpenShell + Podman + Fedora/RHEL Vertex AI Anthropic Quickstart

OpenShell Instructions for Red Hatters to use Anthropic models via Vertex AI

# install
$ sudo dnf copr enable maxamillion/nvidia-openshell
$ sudo dnf install openshell-gateway openshell

# start the rootless user systemd service unit
$ systemctl --user start openshell-gateway.service

# add the local openshell gateway to your client config
$ openshell gateway add https://localhost:17670 --local

# Follow the Vertex AI Claude Code instructions to setup your gcloud creds
# https://docs.google.com/document/d/1eNARy9CI28o09E7Foq01e5WD5MvEj3LSBnXqFcprxjo/edit?tab=t.0#heading=h.8ldy5by9bpo8
# MAKE SURE TO GET YOUR PROJECT NAME, YOU'LL NEED IT IN THE FOLLOWING EXPORT

Option A: GCP Provider using OpenShell's GCE Metadata emulation

# Create the provider credential in OpenShell
$ openshell provider create --name redhat-gcp --type google-cloud --from-gcloud-adc --config project_id="$(gcloud config get-value project)" --config region=global

# Create a sandbox using this provider credential
$ openshell sandbox create --name my-sandbox --provider redhat-gcp

# Next we need to update the network policy (this should be temporary, we'll get this added to the default policy once the provider merges
$ openshell policy update my-sandbox --add-endpoint aiplatform.googleapis.com:443:read-write:rest:enforce --binary /usr/local/bin/claude --binary /usr/bin/opencode --wait

# Once inside the sandbox, either run Claude Code just as outlined in the Google Doc:

# Claude Code
$ CLAUDE_CODE_USE_VERTEX=1 CLOUD_ML_REGION="global" ANTHROPIC_VERTEX_PROJECT_ID="YOUR_ORG_GCLOLUD_PROJECT" claude

# Or alternatively you can use OpenCode
# OpenCode
$ VERTEX_LOCATION="global" GOOGLE_CLOUD_PROJECT="YOUR_ORG_GCLOUD_PROJECT" opencode

Option B: Vertex AI Provider using OpenShell inference.local custom endpoint

$ export vertex_project="YOUR_ORG_GCLOUD_PROJECT"

# Enable the providers v2 feature flag
# (this is necessary for now, but will go away when we migrate from v1 to v2 upstream)
$ openshell settings set --global --key providers_v2_enabled --value true --yes

# Create the provider credential in OpenShell
$ openshell provider create --name vertex-local --type google-vertex-ai --from-gcloud-adc --config VERTEX_AI_PROJECT_ID="${vertex_project}" --config VERTEX_AI_REGION=global

# Set the inference provider
# NOTE: the model is ignored by claude code, but openshell requires the setting
$ openshell inference set --provider vertex-local --model claude-sonnet-4-6

# Create a sandbox using this provider credential
$ openshell sandbox create --name my-sandbox --provider vertex-local

# Once inside the sandbox, either run Claude Code or OpenCode as follows:

# Claude Code
$ ANTHROPIC_BASE_URL="https://inference.local" ANTHROPIC_API_KEY=unused claude --bare

# OpenCode
$ ANTHROPIC_BASE_URL="https://inference.local/v1" ANTHROPIC_API_KEY=unused opencode
@stbenjam

This comment was marked as outdated.

@stbenjam

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment