Skip to content

feat: add GCP Vertex AI as LLM provider#35

Draft
thejacket wants to merge 1 commit intoocrbase-hq:mainfrom
thejacket:feat/gcp-vertex-integration
Draft

feat: add GCP Vertex AI as LLM provider#35
thejacket wants to merge 1 commit intoocrbase-hq:mainfrom
thejacket:feat/gcp-vertex-integration

Conversation

@thejacket
Copy link

Summary

  • Add Google Vertex AI as an alternative LLM provider alongside OpenRouter
  • Users choose via LLM_PROVIDER env var (openrouter | vertex)
  • Configurable model selection via LLM_MODEL for both providers
  • Routes Claude models on Vertex through @ai-sdk/google-vertex/anthropic, Gemini through @ai-sdk/google-vertex
  • All LLM features supported: extraction, schema generation, JSON repair, health check

Why

Self-hosting users on GCP need direct Vertex AI access for:

  • Compliance — VPC Service Controls, HIPAA, SOC 2 (data never leaves GCP, no third-party proxy sees your documents or extracted data).

  • Lower latency — direct API call to Vertex AI in your region, no extra hop through OpenRouter's proxy.

  • Lower cost — no 5% BYOK markup that OpenRouter charges on top of model pricing.

  • Zero-secret auth — With OpenRouter, you manage and rotate API keys manually, pass them through env vars, and risk them leaking in logs or config. Vertex AI uses Application Default Credentials (ADC), which means:

    • On GCE / GKE / Cloud Run: authentication is completely automatic. The service account attached to your workload gets credentials from the metadata server — no keys, no env vars, nothing to configure.
    • On GKE specifically: Workload Identity maps a Kubernetes service account to a GCP service account, so your pods authenticate to Vertex AI without any mounted key files.
    • For local development: just run gcloud auth application-default login once and the SDK picks up your credentials.

    The only config needed is LLM_PROVIDER=vertex and GOOGLE_VERTEX_PROJECT=your-project. No API keys to generate, store, rotate, or worry about leaking.

Demo

Configuration

# Vertex AI (Gemini)
LLM_PROVIDER=vertex
GOOGLE_VERTEX_PROJECT=my-project
LLM_MODEL=gemini-2.5-flash

# Vertex AI (Claude)
LLM_PROVIDER=vertex
GOOGLE_VERTEX_PROJECT=my-project
LLM_MODEL=claude-sonnet-4-5@20250514

# OpenRouter (default, unchanged)
OPENROUTER_API_KEY=sk-...

Test plan

  • bun check-types passes
  • LLM_PROVIDER=openrouter (or unset) — existing behavior unchanged
  • LLM_PROVIDER=vertex with Gemini model — extraction and schema generation work
  • LLM_PROVIDER=vertex with Claude model — routes through Anthropic Vertex provider
  • Health check returns correct status for both providers
  • llmProvider column populated in job records

Support Vertex AI alongside OpenRouter for all LLM features (extraction,
schema generation, JSON repair, health check). Users choose via
LLM_PROVIDER env var and can select specific models via LLM_MODEL.
Vertex routes Claude models through @ai-sdk/google-vertex/anthropic and
Gemini models through @ai-sdk/google-vertex.

Also ignore agent skill directories in oxlint config to fix pre-existing
lint noise from untracked files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant