Skip to main content
Interactive wizard that stores your LLM provider API key so every subsequent praisonai command works without extra configuration.
Running praisonai --init without a configured provider prints a pointer to this page — you do not have to find setup separately.
You do not need praisonai setup at all if a local Ollama endpoint is reachable — PraisonAI adopts it automatically. See Keyless Local-First Run.

Quick Start

1

Run the setup wizard

The interactive wizard walks you through provider selection and key entry.
2

Confirm the detected provider

If a provider key is already in your environment, the wizard confirms it instead of showing the menu (the wizard inspects the environment — it isn’t tied to any one provider):
Press Enter to accept, or answer n to pick a different provider from the numeric menu.
3

Choose a provider (fallback)

Shown only when no *_API_KEY was detected or you declined the detected one. The menu is now catalogue-driven, built from ModelCatalogue.list_providers()openai, anthropic, google, ollama first, every other catalogue provider (Groq, OpenRouter, Mistral, DeepSeek, xAI, …) next, and custom last — not a hardcoded five:
The exact list follows ModelCatalogue.list_providers(), so new providers appear automatically as the catalogue grows — no code change in setup. A one-line “Get your key” hint prints before the masked prompt for well-known providers.
4

Enter your API key

A Get your key: link to the provider’s key-creation page prints before the hidden prompt for catalogue providers:
The key is validated against the provider’s expected format (same check as auth login); a bad key re-prompts up to three times before setup proceeds. Keys are stored in ~/.praisonai/.env with permissions 0600.
5

Verified automatically

Setup runs a one-shot Agent.start("Say hello in one sentence") and prints the reply. Skip with --no-verify in offline/CI.

CLI Flags

The --no-verify flag applies to both setup and setup wizard — the sub-command inherits it.

Subcommands


Non-interactive Mode

For CI/CD or scripted setup:
Curated providers and their auto-detected env vars — set any one of these and the wizard pre-selects that provider: Any catalogued provider (Mistral, DeepSeek, xAI, Together, Perplexity, Fireworks, …) is now auto-detected by --non-interactive in addition to the curated four — set MISTRAL_API_KEY (or any catalogued key) and praisonai setup --non-interactive picks it up without --provider. You don’t need to know about the catalogue to benefit. See the full Credential → default-model map for the 14 detected keys.

Any catalogue provider

--provider in non-interactive mode accepts any provider returned by ModelCatalogue.list_providers() — not just the five above. For a catalogue provider without a curated row, the env-var name is derived as <PROVIDER>_API_KEY:
groqGROQ_API_KEY, openrouterOPENROUTER_API_KEY, and so on. A few providers keep a canonical override: google/geminiGEMINI_API_KEY, perplexityPERPLEXITYAI_API_KEY. Providers with multiple env-var spellings round-trip back under the same alias you set: Setting TOGETHERAI_API_KEY (or FIREWORKS_AI_API_KEY) writes back to that same spelling — the run no longer ends without a resolved key. Existing google / gemini alias behaviour is unchanged.

Post-setup smoke test

After the wizard writes your config, it runs one live call to confirm the credential is good. Passing case — the reply is printed and the agent is confirmed working:
Failing case — a bad key or no network. The config is still saved; the failure is a warning, not an abort:
Skip the smoke test entirely for offline or CI installs:
Use --no-verify in CI or offline installs where the smoke test would fail due to no network.
If verification fails, your config is already saved — run praisonai doctor to diagnose the key or model.

Where Credentials Are Stored

praisonai setup now writes three files so the same key is visible to every CLI code path (setup, auth list, run / inject_credentials_into_env): The credential-store mirror means a key set via praisonai setup shows up in praisonai auth list and is picked up by praisonai run without exporting anything.
CI / zero-disk override. PRAISONAI_AUTH_CONTENT takes precedence over all three files setup writes. When it’s set, credentials load from that JSON blob in memory and nothing is read from or written to disk — ideal for containers. See Zero-disk credentials.
setup writes to the same canonical home that every other CLI subsystem — sessions, traces, logs, cache, config set — reads. PRAISONAI_HOME re-roots all of them together (see CLI Home Root).
Legacy path migration. Prior releases used ~/.praison/credentials.json. That location is now a read-only backward-compat fallback: it’s still read if the canonical ~/.praisonai/credentials.json doesn’t exist yet, and any write transparently migrates your old entries onto the canonical file. You don’t need to re-run auth login or lose any stored providers — running setup (or any auth login) once completes the migration. No re-login is required. The same read-once-write-canonical migration applies to ~/.praison/config.toml: the first praisonai config set / praisonai config reset copies its values forward to ~/.praisonai/config.toml automatically.
Local providers like ollama (no API key) are skipped for the credential-store mirror — only providers with a real key/env var are written to credentials.json. If the mirror step fails for any reason (permissions, disk full), setup prints a warning and continues — the .env file is the primary artifact and is written first.
PRAISONAI_HOME is honoured, and a leading ~ in the override value is expanded (via Path(home).expanduser()) so PRAISONAI_HOME=~/custom and PRAISONAI_HOME=$HOME/custom resolve identically — the same directory every other subsystem uses. When PRAISONAI_HOME points at a non-default directory, setup writes credentials.json under that directory. When it equals the default ~/.praisonai, setup keeps the legacy-fallback + migration path active.
CLI state (sessions, traces, logs, cache, model-recency) now lives under the same canonical ~/.praisonai/ used by praisonai setup and the SDK. Set PRAISONAI_HOME to relocate all of it in one place (packaging systems: Nix, Docker, Snap). A pre-existing ~/.praison/config.toml is still honoured read-only when it is the sole config present, but new writes go to ~/.praisonai/.
All sensitive files are written with chmod 600 and are never included in any telemetry data.

What happens if you skip --model

When you don’t pass --model to setup (or when you run a command like praisonai chat with no --model), PraisonAI picks a sensible default that matches the provider you actually have a key for — it no longer always picks an OpenAI model.

Resolution precedence

Credential → default-model map

The first credential found wins, in this order: This map is now derived from PROVIDER_ENV_CATALOGUE in praisonai_code/llm/catalogue.py — one source of truth for first-run auto-detection and default-model inference. _PROVIDER_DEFAULTS in llm/env.py derives from the same catalogue (with a literal fallback), so run-time inference and setup detection stay in sync. Adding a provider is now a data row, not spread-out code. The historical eight stay at the head of the catalogue, so ordered-preference behaviour is unchanged — OPENAI_API_KEY still wins when both it and MISTRAL_API_KEY are present. The additions are purely additive and backward compatible. When a provider declares multiple env-var spellings (Together, Fireworks), whichever you actually set is honoured for both detection and the credential written back. The last row is the detection case — when no cloud key is set, PraisonAI probes for a running local endpoint and adopts what detect_local_model() returns. See Keyless Local-First Run.
The setup wizard shows its own refreshed defaults from SetupHandler._provider_defaults() — Anthropic claude-sonnet-4-20250514, Google gemini-2.5-flash, and OpenAI sourced from DEFAULT_FALLBACK_MODEL. These are the values pre-filled at the model-selection step; the run-time inference table above is the fallback used later when an Agent starts without an explicit model.
The first time a provider-aware default is inferred, the CLI prints a one-line notice:
Only user-chosen values (explicit --model, env overrides) are persisted as the recent model. Provider-inferred defaults and the terminal fallback (DEFAULT_FALLBACK_MODEL, currently gpt-4o-mini) are deliberately not persisted — this keeps model selection fresh if your available providers change between runs.
The recency file lives at ~/.praisonai/state/model.json under the canonical home root (override with PRAISONAI_HOME). It is created on demand; if it’s missing or unreadable, resolution falls straight through to provider inference and works normally.

When Does Setup Run Automatically?

If you skip setup at install time (or run --no-prompt), the first praisonai, praisonai run, praisonai code, or praisonai chat command detects the missing credentials and offers to launch this wizard for you. See First-run Onboarding for the full flow.
setup is now a suggestion, not a hard requirement, when a local endpoint (e.g. Ollama) is running — PraisonAI auto-detects the local model and continues. See Keyless local-first.

Best Practices

praisonai setup is idempotent — running it again overwrites the previous configuration. Use it whenever you switch providers or need to rotate an API key.
In CI environments set OPENAI_API_KEY (or the provider-specific key) as a secret. On developer workstations use praisonai setup so you don’t have to set env vars in every shell session.
API keys are masked in the output. Only non-sensitive settings (provider, model) appear in plaintext.
With just one credential env var set (e.g. ANTHROPIC_API_KEY), running praisonai chat without --model now picks the matching default automatically. You only need --model to override or to mix providers in one session. On first run, the same resolved model is validated by the onboarding gate.
By default praisonai setup finishes by running a one-shot Agent.start(...) to confirm your key and model work. If you’re setting up offline or in CI where the smoke test would fail, pass --no-verify.

First-run Onboarding

Auto-detects missing credentials at first invocation

Quick Start (--init)

Generate agents.yaml with praisonai --init — links here when no provider is configured

Run Command

Run agents from files or prompts

CLI Reference

Complete command tree and flag reference

Installer Internals

How the installer sets up credentials at install time