Register and inspect the Google AI Studio API key that `pks image` and `pks promptwall` use for Gemini-based image generation.
pks google <command> [options]$ pks google initRegister a key, or view the existing masked key
$ pks google init --forceOverwrite an already-registered key
$ pks google statusCheck what key is stored and when
pks google manages the single Google AI Studio API key pks uses for Gemini-based image generation. The group itself takes no direct action — init registers and validates the key, status shows what's stored.
The key is a Google AI Studio ("Generative Language API") key, not an OAuth token or service account. pks google init prompts for it once with masked input, validates it with a live call to the Generative Language API, and stores it in ~/.pks-cli/settings.json. Two downstream commands consume it:
pks image — resolves the google provider automatically when --model names a Gemini image model, or when forced with --provider google.pks promptwall — checks for a registered key before running and points back to pks google init if none is found.https://aistudio.google.com/apikey — the init command prints this URL itself.pks google <command> [options]
init Register (or view) the Google AI Studio API key
status Show whether a key is registered, masked
pks google reads no environment variables of its own.
Registers a Google AI Studio API key for Gemini-based image generation. Prompts for the key with masked input, validates it with a live GET against the Generative Language API's models endpoint, and on success stores the key plus a UTC registration timestamp in ~/.pks-cli/settings.json. If a key is already registered, it short-circuits and prints the existing masked key and registration date instead of re-prompting, unless --force is passed. On validation failure it exits 1 without storing anything.
| Flag | Default | Description |
|---|---|---|
--force | false | Re-register even if a key is already stored. |
Endpoint: GET https://generativelanguage.googleapis.com/v1beta/models?key=... — used only to validate the key; nothing is generated by this call.
pks google init
Prompts for the key, validates it, and stores it. If a key is already present, this prints the existing masked key instead of prompting again — pass --force to replace it.
pks google init --force
Prompts for a new key and overwrites whatever was previously stored, even if a key already exists.
Shows whether a Google AI API key is currently registered and, if so, its masked form and registration timestamp in a table. Read-only — it makes no network calls, only reads local config. Exits 1 with a pointer to pks google init if nothing is registered.
No flags.
pks google status
Prints the masked key (first 4 characters plus up to 8 asterisks) and the registration date, or reports that no key is registered.
Note.
pks google statusexits1when no key is registered — in scripts, treat that as an expected "not configured" state rather than a failure.
pks image or pks promptwall says no key is registered. Run pks google init. Both commands fail fast with an actionable message rather than silently falling back to another provider.pks google init says validation failed, with no further detail. The HTTP call to the Generative Language API is wrapped in a catch-all that returns false on any exception, including network errors, a revoked or restricted key, and the "Generative Language API" not being enabled on the Google Cloud project. Re-check the key at https://aistudio.google.com/apikey and confirm the API is enabled on that project.pks google init doesn't seem to do anything. Without --force, init is a no-op once a key exists — it only redisplays the existing masked key. Use --force to actually replace it.pks google. The only way to change the key is pks google init --force; to remove it entirely, edit ~/.pks-cli/settings.json by hand.pks google init writes the raw key to ~/.pks-cli/settings.json in the open, not encrypted, even though the underlying config store supports an encrypt flag — this command doesn't use it. Treat that file as sensitive.imagen-3.x) require Vertex AI credentials and are not reachable through a Google AI Studio key.