Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(ui): the Vertex cards, and a key hint that stops guessing the account

Harald4e62c1e71683
diff --git a/jarvis/ui/web/frontend/src/components/ApiKeyForm.tsx b/jarvis/ui/web/frontend/src/components/ApiKeyForm.tsx
index fa87887dad..f9542835eb 100644
--- a/jarvis/ui/web/frontend/src/components/ApiKeyForm.tsx
+++ b/jarvis/ui/web/frontend/src/components/ApiKeyForm.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { AlertTriangle, CheckCircle2, Eye, EyeOff, ExternalLink, Trash2 } from "lucide-react";
import { Button } from "@/components/ui/button";
import { deleteSecret, postSecret } from "@/hooks/useProviders";
-import { keyMatchesSecret } from "@/lib/keyFormat";
+import { keyFormatConfirmed, keyMatchesSecret } from "@/lib/keyFormat";
import { useEventStore } from "@/store/events";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
@@ -296,7 +296,7 @@ export function ApiKeyForm({ secretKey, dashboardUrl, configured, credentialHelp
the format this slot expects. A non-technical user pasting a long
random string has no way to tell "right kind of key" from "garbage" —
this answers it before they hit Save. Format only, never validity. */}
- {fmt && fmt.match && fmt.expected && fmt.detected?.kind === fmt.expected && (
+ {fmt && keyFormatConfirmed(fmt) && (
<p className="flex items-start gap-1 text-[11px] text-emerald-600 dark:text-emerald-400">
<CheckCircle2 className="mt-0.5 h-3 w-3 shrink-0" />
<span>{t("apikeys_view.format_match_hint")}</span>
diff --git a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
index 1ab7882dbf..a7d54d0885 100644
--- a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
@@ -594,6 +594,9 @@ const PROVIDER_ICON: Record<string, string> = {
"openai-codex": "openai",
"claude-api": "claude",
gemini: "gemini",
+ // Vertex AI serves the same Gemini models; the Gemini mark is the honest
+ // nominative-use glyph for it (TRADEMARK.md) and beats a letter monogram.
+ vertex: "gemini",
openrouter: "openrouter",
nvidia: "nvidia",
antigravity: "antigravity",
diff --git a/jarvis/ui/web/frontend/src/lib/keyFormat.test.ts b/jarvis/ui/web/frontend/src/lib/keyFormat.test.ts
index a3608108a2..a69de6a522 100644
--- a/jarvis/ui/web/frontend/src/lib/keyFormat.test.ts
+++ b/jarvis/ui/web/frontend/src/lib/keyFormat.test.ts
@@ -1,5 +1,10 @@
import { describe, expect, it } from "vitest";
-import { detectKeyFormat, expectedKindForSecret, keyMatchesSecret } from "./keyFormat";
+import {
+ detectKeyFormat,
+ expectedKindForSecret,
+ keyFormatConfirmed,
+ keyMatchesSecret,
+} from "./keyFormat";
describe("detectKeyFormat", () => {
it("returns null for blank input", () => {
@@ -18,9 +23,15 @@ describe("detectKeyFormat", () => {
// sent express-key users into a silent auth dead end).
const hint = detectKeyFormat("AQ.Ab8RN6...rest");
expect(hint?.label).toBe("Google API key (AI Studio or Vertex)");
- expect(hint?.note).toContain("detects the right endpoint");
+ expect(hint?.note).toContain("decides the endpoint");
+ // The AIza label stays endpoint-NEUTRAL too. It used to read "Google AI
+ // Studio key", which became actively misleading once the same shape could be
+ // a Cloud API key restricted to aiplatform.googleapis.com — a Vertex user
+ // would be told their correct key was an AI Studio one, in the very field
+ // this module exists to keep straight.
const classic = detectKeyFormat("AIzaSyABCDEF1234567890");
- expect(classic?.label).toBe("Google AI Studio key");
+ expect(classic?.label).toBe("Google API key");
+ expect(classic?.note).toContain("Vertex AI");
});
it("recognizes a Vertex AI service-account JSON, not an AI Studio key", () => {
@@ -96,4 +107,50 @@ describe("keyMatchesSecret", () => {
expect(keyMatchesSecret("gemini_api_key", "").match).toBe(true);
expect(keyMatchesSecret("gemini_api_key", " ").detected).toBeNull();
});
+
+ // A Vertex key wears the SAME AIza / AQ. shape as an AI Studio one — which
+ // account it belongs to is invisible in the string. Warning about that would
+ // fire on every correctly pasted Vertex key, so the two Google kinds are
+ // treated as compatible in both directions.
+ it("never cries mismatch between the two indistinguishable Google kinds", () => {
+ for (const slot of ["vertex_api_key", "realtime_vertex_api_key"]) {
+ for (const key of ["AIzaSy123", "AQ.Ab8RN6xyz"]) {
+ expect(keyMatchesSecret(slot, key).match).toBe(true);
+ }
+ }
+ expect(keyMatchesSecret("gemini_api_key", "AQ.Ab8RN6xyz").match).toBe(true);
+ });
+
+ it("still flags a genuinely foreign key in a Vertex field", () => {
+ const r = keyMatchesSecret("vertex_api_key", "sk-ant-api03-xyz");
+ expect(r.match).toBe(false);
+ expect(r.detected?.kind).toBe("anthropic");
+ });
+
+ it("flags a service-account JSON pasted into the Vertex KEY field", () => {
+ // The project path takes a FILE PATH in jarvis.toml, not the JSON itself in
+ // the key box — the most likely Vertex-specific mistake there is.
+ const r = keyMatchesSecret("vertex_api_key", '{"type":"service_account"}');
+ expect(r.match).toBe(false);
+ expect(r.detected?.kind).toBe("vertex-service-account");
+ });
+});
+
+describe("keyFormatConfirmed", () => {
+ it("gives a Vertex slot the green tick for a Google-shaped key", () => {
+ // Without the compatibility rule the tick never appears on a Vertex card,
+ // leaving every correct key looking unverified.
+ expect(keyFormatConfirmed(keyMatchesSecret("vertex_api_key", "AIzaSy123"))).toBe(true);
+ });
+
+ it("withholds it for a key we do not recognize", () => {
+ // match=true there means "no complaint", which is not the same as "right".
+ const r = keyMatchesSecret("vertex_api_key", "some-opaque-token");
+ expect(r.match).toBe(true);
+ expect(keyFormatConfirmed(r)).toBe(false);
+ });
+
+ it("withholds it for a confirmed mismatch", () => {
+ expect(keyFormatConfirmed(keyMatchesSecret("vertex_api_key", "sk-ant-x"))).toBe(false);
+ });
});
diff --git a/jarvis/ui/web/frontend/src/lib/keyFormat.ts b/jarvis/ui/web/frontend/src/lib/keyFormat.ts
index d3a226052b..75cc07ccd9 100644
--- a/jarvis/ui/web/frontend/src/lib/keyFormat.ts
+++ b/jarvis/ui/web/frontend/src/lib/keyFormat.ts
@@ -12,6 +12,13 @@
export type KeyFormatKind =
| "google-aistudio"
+ // What a Vertex AI slot EXPECTS. Never returned by `detectKeyFormat`: a
+ // Vertex key wears the same `AIza` / `AQ.` shape as an AI Studio one, so no
+ // amount of staring at the string can tell them apart. It exists so the UI
+ // can name what a slot wants, while `keyMatchesSecret` treats the two Google
+ // kinds as compatible and stays silent instead of crying mismatch over a
+ // perfectly good key.
+ | "google-vertex"
| "vertex-service-account"
| "anthropic"
| "openai"
@@ -58,21 +65,26 @@ export function detectKeyFormat(value: string): KeyFormatHint | null {
if (/^sk_/.test(v)) return { kind: "elevenlabs", label: "ElevenLabs API key" };
if (/^gsk_/.test(v)) return { kind: "groq", label: "Groq API key" };
if (/^xai-/.test(v)) return { kind: "xai", label: "xAI (Grok) API key" };
+ // AIza is the classic Google API-key prefix, used by AI Studio AND by a
+ // Google Cloud API key restricted to aiplatform.googleapis.com. Which one it
+ // is depends on the project it was created in, not on the string, so the slot
+ // it is pasted into is what decides where Jarvis sends it.
if (/^AIza/.test(v)) {
return {
kind: "google-aistudio",
- label: "Google AI Studio key",
- note: "Looks like a Google AI Studio key — Jarvis uses it directly.",
+ label: "Google API key",
+ note: "A Google API key. Jarvis sends it to AI Studio or to Vertex AI depending on which card you saved it under.",
};
}
// AQ. is issued by BOTH Google AI Studio and Vertex AI express mode — the
- // prefix cannot tell them apart. Same kind (the Gemini slots accept both);
- // the backend probes once and routes the key to the right endpoint.
+ // prefix cannot tell them apart. Same kind (both Google slots accept it); in
+ // the Gemini slots the backend probes once and routes the key, and in a Vertex
+ // slot the endpoint is already decided by the card.
if (/^AQ\./.test(v)) {
return {
kind: "google-aistudio",
label: "Google API key (AI Studio or Vertex)",
- note: "AI Studio and Vertex AI express keys share this format — Jarvis detects the right endpoint automatically.",
+ note: "AI Studio and Vertex AI express keys share this format — the card you save it under decides the endpoint, and for a Gemini card Jarvis detects it automatically.",
};
}
if (/^sk-/.test(v)) return { kind: "openai", label: "OpenAI API key" };
@@ -90,6 +102,11 @@ export function expectedKindForSecret(secretKey: string): KeyFormatKind | null {
case "realtime_gemini_api_key":
case "jarvis_agent_gemini_api_key":
return "google-aistudio";
+ case "vertex_api_key":
+ case "google_vertex_api_key":
+ case "realtime_vertex_api_key":
+ case "jarvis_agent_vertex_api_key":
+ return "google-vertex";
case "anthropic_api_key":
case "jarvis_agent_anthropic_api_key":
return "anthropic";
@@ -128,12 +145,24 @@ export interface KeyMatchResult {
expected: KeyFormatKind | null;
}
+/**
+ * Google API-key kinds that no string inspection can separate. An `AIza` /
+ * `AQ.` key is valid for an AI Studio slot or a Vertex AI slot depending only on
+ * the project it came from, so a mismatch warning between them would be a guess
+ * dressed up as a finding — and would fire on every correctly pasted Vertex key.
+ */
+const GOOGLE_KEY_KINDS: ReadonlySet<KeyFormatKind> = new Set<KeyFormatKind>([
+ "google-aistudio",
+ "google-vertex",
+]);
+
/**
* Compares an entered value against the format its slot expects. Stays neutral
- * (`match: true`) for blank input, for slots without a known format, and for
- * an unrecognized but possibly-valid key — it only reports `match: false` when
- * the value is confidently a DIFFERENT known provider's key (the actionable
- * mistake). Never blocks; the UI shows this as a soft warning.
+ * (`match: true`) for blank input, for slots without a known format, for an
+ * unrecognized but possibly-valid key, and between the two indistinguishable
+ * Google kinds — it only reports `match: false` when the value is confidently a
+ * DIFFERENT known provider's key (the actionable mistake). Never blocks; the UI
+ * shows this as a soft warning.
*/
export function keyMatchesSecret(secretKey: string, value: string): KeyMatchResult {
const detected = detectKeyFormat(value);
@@ -144,5 +173,26 @@ export function keyMatchesSecret(secretKey: string, value: string): KeyMatchResu
if (detected.kind === "unknown") {
return { match: true, detected, expected };
}
+ if (GOOGLE_KEY_KINDS.has(detected.kind) && GOOGLE_KEY_KINDS.has(expected)) {
+ return { match: true, detected, expected };
+ }
return { match: detected.kind === expected, detected, expected };
}
+
+/**
+ * Whether the entered value is POSITIVELY the right shape for its slot — the
+ * condition for the green reassurance, as opposed to merely "no complaint".
+ *
+ * Separate from `match` because the two differ: `match` is also true for a key
+ * we simply do not recognize, where saying "looks right" would be a guess. The
+ * Google pair counts as confirmed even though the kinds are not equal, since an
+ * `AIza` / `AQ.` key IS the shape a Vertex slot wants — it is the account behind
+ * it that no local check can see, and withholding the tick over that would leave
+ * every correctly pasted Vertex key looking unverified.
+ */
+export function keyFormatConfirmed(result: KeyMatchResult): boolean {
+ const { detected, expected, match } = result;
+ if (!match || !detected || expected === null) return false;
+ if (detected.kind === expected) return true;
+ return GOOGLE_KEY_KINDS.has(detected.kind) && GOOGLE_KEY_KINDS.has(expected);
+}
diff --git a/jarvis/ui/web/provider_spec.py b/jarvis/ui/web/provider_spec.py
index 85d35b2377..d0415e470a 100644
--- a/jarvis/ui/web/provider_spec.py
+++ b/jarvis/ui/web/provider_spec.py
@@ -160,6 +160,30 @@ _GEMINI_VERTEX = AltCredential(
)
+# The Vertex cards' OWN alternative path: a real Cloud project instead of a key.
+# Same split as above, mirrored — the key field is the easy way in, and this note
+# is what tells a user with a production project that they do not need a key at
+# all. Shared by all four Vertex cards (brain, STT, TTS, realtime) so the
+# instructions cannot drift between tiers.
+_VERTEX_PROJECT_PATH = AltCredential(
+ label="Google Cloud project (no key)",
+ billing="api",
+ credential_help=(
+ "Instead of a key, point Jarvis at a Cloud project: set "
+ "[google].vertex_project to the project id that owns "
+ "aiplatform.googleapis.com, [google].vertex_location to a region "
+ "(\"global\" is the default and has the widest Gemini availability), and "
+ "— only if this machine is not already signed in with gcloud — "
+ "[google].service_account_path to a service-account JSON. Requests are "
+ "then signed with Application Default Credentials. This is the path a "
+ "production project uses, and the one without the preview-model daily "
+ "cap that the AI Studio account has."
+ ),
+ dashboard_url="https://console.cloud.google.com/iam-admin/serviceaccounts",
+ credential_path_hint="~/.config/jarvis/vertex-sa.json",
+)
+
+
# ── Dictation polish: the cards are DERIVED, not declared ─────────────────────
# The family list itself lives in ``jarvis.dictation.polish_client`` and is the
# single source of truth for ids, labels, credential slots and default models.
@@ -361,6 +385,32 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
recommended=True,
recommended_model="gemini-3.5-flash",
),
+ # ── Brain: the SAME Gemini models on Google Cloud Vertex AI ──
+ # Its own card, not a checkbox on the Gemini one, for a reason the 2026-06-22
+ # forensic paid for: the two accounts bill separately, so an install must be
+ # able to hold BOTH credentials and point each tier at the one it means. A
+ # shared slot forces a choice the user then cannot see they made.
+ ProviderSpec(
+ id="vertex",
+ label="Google Vertex AI",
+ tier="brain",
+ auth_mode="api_key",
+ secret_keys=("vertex_api_key",),
+ dashboard_url="https://console.cloud.google.com/vertex-ai/studio",
+ credential_help=(
+ "Vertex AI API key from your Google Cloud project — either an "
+ "express-mode key (AQ.) or a Cloud API key restricted to "
+ "aiplatform.googleapis.com (AIza). Same Gemini models as the card "
+ "above, billed to your Cloud project instead of an AI Studio "
+ "account. For a production project you can skip the key entirely: "
+ "set [google].vertex_project (plus vertex_location, and "
+ "service_account_path if you are not already signed in with gcloud) "
+ "and Vertex authenticates through Application Default Credentials. "
+ "One Vertex setup serves the brain, the tool model, voice input, "
+ "voice output, realtime and the subagents."
+ ),
+ alt_credential=_VERTEX_PROJECT_PATH,
+ ),
# ── Brain: Google subscription via the official Antigravity/Gemini CLI ──
# OAuth-only (no API-key slot): we drive the official ``agy``/``gemini`` CLI
# as a subprocess over the user's "Sign in with Google" login — billed
@@ -598,6 +648,27 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
),
alt_credential=_GEMINI_VERTEX,
),
+ # The production half of the card above. The AI Studio TTS preview model is
+ # hard-capped at 100 requests/day regardless of billing, which is what forced
+ # a daily mid-session voice switch (2026-05-26); a Cloud project has no such
+ # cap. Same 30 voices, same picker, same default — only the account differs.
+ ProviderSpec(
+ id="vertex-tts",
+ label="Vertex AI Text to Speech",
+ tier="tts",
+ auth_mode="api_key",
+ secret_keys=("vertex_api_key",),
+ dashboard_url="https://console.cloud.google.com/vertex-ai/studio",
+ credential_help=(
+ "The Gemini voices on Google Cloud Vertex AI, using the shared "
+ "Vertex credential. Pick this over the card above for a voice that "
+ "has to keep working all day: the AI Studio preview TTS model is "
+ "capped at 100 requests per day no matter how you are billed, and a "
+ "Cloud project is not. Works with a Vertex API key or, with no key "
+ "at all, a Cloud project via [google].vertex_project."
+ ),
+ alt_credential=_VERTEX_PROJECT_PATH,
+ ),
ProviderSpec(
id="grok-voice",
label="xAI Text to Speech",
@@ -686,6 +757,38 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
"lists only transcription-capable models."
),
),
+ # Both Google recognizers get a card. Gemini STT shipped as an entry-point
+ # with no card at all, which made a working provider selectable only by
+ # hand-editing jarvis.toml — a feature the app had but did not offer.
+ ProviderSpec(
+ id="gemini-api",
+ label="Gemini STT",
+ tier="stt",
+ auth_mode="api_key",
+ secret_keys=("gemini_api_key",),
+ dashboard_url="https://aistudio.google.com/app/apikey",
+ credential_help=(
+ "Uses the same Google AI Studio key as the Gemini brain — no second "
+ "key needed. Transcribes through Gemini's audio understanding "
+ "rather than a dedicated speech model."
+ ),
+ alt_credential=_GEMINI_VERTEX,
+ ),
+ ProviderSpec(
+ id="vertex-stt",
+ label="Vertex AI STT",
+ tier="stt",
+ auth_mode="api_key",
+ secret_keys=("vertex_api_key",),
+ dashboard_url="https://console.cloud.google.com/vertex-ai/studio",
+ credential_help=(
+ "The same recognizer on Google Cloud Vertex AI, using the shared "
+ "Vertex credential — set Vertex up once and it serves voice input "
+ "too. Works with a Vertex API key or, with no key at all, a Cloud "
+ "project via [google].vertex_project."
+ ),
+ alt_credential=_VERTEX_PROJECT_PATH,
+ ),
# Local, keyless STT. This card was REMOVED once (2026-07-03, v1.0.1) and is
# back under the condition that made the removal necessary: it may never
# claim a readiness nobody verified. Both original defects are fixed at the
@@ -789,6 +892,27 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
"remain a compatibility fallback until a dedicated key is saved."
),
),
+ # The same duplex socket on Google Cloud. A DISTINCT credential family, which
+ # is what makes it a genuine fallback for its sibling rather than a retry: a
+ # Cloud project and an AI Studio account run out of quota independently
+ # (AP-22).
+ ProviderSpec(
+ id="vertex-live",
+ label="Vertex AI Live",
+ tier="realtime",
+ auth_mode="api_key",
+ secret_keys=("realtime_vertex_api_key",),
+ dashboard_url="https://console.cloud.google.com/vertex-ai/studio",
+ credential_help=(
+ "Vertex AI key dedicated to the realtime voice socket. Falls back to "
+ "the shared Vertex key, and needs no key at all when "
+ "[google].vertex_project points at a Cloud project. Google documents "
+ "the Live API as reachable this way through the Gen AI SDK; if your "
+ "project or key cannot open the socket, Jarvis says so and moves to "
+ "the next realtime provider instead of failing the call."
+ ),
+ alt_credential=_VERTEX_PROJECT_PATH,
+ ),
# The local option this tier lacked entirely: every other realtime card
# bills a hosted account, so an install running brain, recognizer and voice
# on its own hardware still had to leave the machine for the low-latency