praisonai --init is now safe to run before setup — if no provider is configured it prints provider guidance and exits cleanly rather than throwing a stack trace. Either order works for onboarding.
praisonai (bare), praisonai run, praisonai code, and praisonai chat — route their first-run check through the same shared helper, so a keyless newcomer is offered the wizard (or a clean hint) from any first command.
Onboarding Flow
When no cloud key is configured, PraisonAI checks for a reachable local endpoint (
detect_local_endpoint()) before prompting the wizard. If a local Ollama or OpenAI-compatible server answers, it prints a one-line stderr notice and continues — the wizard prompt (TTY) or exit 1 (non-TTY) only fires when nothing is reachable. See Keyless Local-First Run.Quick Start
1
Run praisonai without any setup
Y (or press Enter) to launch the setup wizard.If a local endpoint (e.g. Ollama) is already running, PraisonAI skips the prompt and uses it — see Keyless local-first.
2
Complete setup once
The setup wizard asks for your provider and API key, then stores the credential securely:Credentials are stored in
On first run, the picker shows every catalogue-known provider (Groq, OpenRouter, Mistral, DeepSeek, xAI, …) — not just the historical curated five — and prints a
Get your key: link before the masked prompt.When any catalogued credential env var is already exported (OpenAI/Anthropic/Google/Gemini as before, plus Groq, OpenRouter, Ollama, Mistral, DeepSeek, xAI, Together (
TOGETHER_API_KEY or TOGETHERAI_API_KEY), Perplexity, or Fireworks (FIREWORKS_API_KEY or FIREWORKS_AI_API_KEY)), the wizard skips the menu and pre-selects that provider — you only confirm. See the full 14-row table.~/.praisonai/credentials.json (permissions 0600). Legacy ~/.praison/credentials.json is still read as a fallback and migrated automatically on the next write — no re-login required.3
Re-run — no prompts after the first time
Wizard flow (post-#2680)
The wizard moves through three stages: auto-detect, validate, and smoke-test.1
Auto-detect a key you already have
If a Answer
*_API_KEY is already exported, the first prompt is a confirmation — not a numeric menu:n to fall through to the full provider menu. The pre-selection surface is no longer four keys — the wizard auto-detects any catalogued credential env var (the full 14-row table), including Together (TOGETHER_API_KEY / TOGETHERAI_API_KEY) and Fireworks (FIREWORKS_API_KEY / FIREWORKS_AI_API_KEY) aliases. The provider menu only appears when no key is detected, and is catalogue-driven — it lists every provider ModelCatalogue knows about (Groq, OpenRouter, Mistral, DeepSeek, xAI, …), curated ones first and custom last.Just having a catalogued key set is enough — no wizard, no --model:- Mistral
- DeepSeek
- Fireworks
2
Validate the key before it persists
Entered keys run through the same After up to three attempts the wizard proceeds with the last entry so you’re never stuck in a loop.
validate_api_key() check as praisonai auth login. A bad key re-prompts instead of silently writing a broken credential:3
Smoke-test before handing back the prompt
After the config is written, the wizard runs one live call and prints the reply:A failed smoke test is a warning, not an error — your config is already saved, so you can run
praisonai doctor to diagnose the key or model.Pass The wizard still writes the config; it just doesn’t dial the LLM.
--no-verify to skip the smoke test when running offline or in CI:How It Works
praisonai (bare), praisonai run, praisonai code, and praisonai chat all perform the same credential check before doing any work — each one delegates to the shared ensure_configured_or_onboard() helper.
Shared onboarding helper
Every entrypoint funnels its first-run check through one choke point,ensure_configured_or_onboard(*, model, interactive) in praisonai_code/llm/credentials.py. It returns the model unchanged when already configured, adopts a reachable local endpoint (with a one-line stderr notice) when keyless and no explicit model is set, exits 1 with Run: praisonai setup when keyless and headless, and offers the setup wizard when keyless in an interactive TTY. Because all four commands share it, onboarding behaviour is identical no matter which command a newcomer types first.
Credential detection order
Provider auto-detection is catalogue-driven — any provider with its API-key env var set is recognised, not just OpenAI/Anthropic/Google/Ollama. See Provider Auto-Detection for the full env-var → default-model table.
praisonai run "..." works against a running Ollama on localhost:11434 with zero setup. See Keyless local-first fallback and Local Models.
PRAISONAI_HOME relocates the entire CLI home (config.yaml, .env, credentials.json, sessions, traces, logs, cache) in one place; it defaults to ~/.praisonai/. See Delivery Config → base directory override.Behaviour by Mode
This table applies to all four entrypoints (praisonai, run, code, chat) — they share the same ensure_configured_or_onboard() gate.
Headless triggers per entrypoint
“Headless” (interactive=False) is decided per command — this is what “non-TTY” means for each:
Standalone pip install praisonai-code (no wrapper)
Two entrypoints skip the gate when the wrapper isn’t installed so the resident TUI can surface its own actionable install hint (pip install praisonai[tui]) instead of a raw “No API key configured” exit:
- Bare
praisonaiand interactivepraisonai chat(no prompt) run the gate only when the wrapper is available. On a barepraisonai-codeinstall, the gate is skipped and the TUI shows its own hint. - Single-prompt
chat "…"and everypraisonai codeinvocation always run the gate — no wrapper is needed to dispatch a single turn.
First command is praisonai code
A brand-new user whose first-ever command is praisonai code "add a test for foo" now lands in onboarding instead of a raw provider error.
- Interactive TTY
- Headless (-p)
- Keyless + local Ollama
praisonai chat uses --json for the headless line. See Chat → First-run credential gate and Code → First-run credential gate.
Keyless local-first (Ollama & OpenAI-compatible)
With a model already running locally, PraisonAI works before you configure any cloud key.Endpoint precedence
The detector resolves the endpoint to probe in this order, then hits Ollama’s native/api/tags first (falling back to the OpenAI-compatible /v1/models):
Model id labels
The detected model id carries a provider prefix so it routes to the right path:Cloud keys always win. Local detection is a fallback only — if
OPENAI_API_KEY (or any other cloud provider key) is present, that key is used and the local probe never runs.CI / Scripting
In non-interactive environments with no credentials and no reachable local endpoint, PraisonAI exits with code1 and writes to stderr:
not sys.stdin.isatty() or --output json mode.
GitHub Actions example
Keyless CI with an in-cluster Ollama sidecar
A CI runner that ships an Ollama sidecar can run keylessly by pointingOLLAMA_HOST at it — no cloud secret required:
Skipping the Prompt
Several ways to avoid the setup prompt:Ephemeral / CI environments. On ephemeral runners you can skip both
setup and auth login entirely — set PRAISONAI_AUTH_CONTENT for credentials and PRAISONAI_CONFIG_CONTENT (or PRAISONAI_CONFIG for a mounted file) for the user-config layer. PraisonAI will run without reading or writing anything under ~/.praisonai/. See Zero-disk config and Zero-disk credentials.Default model on first run
If you run a command likepraisonai chat without --model on first use, PraisonAI picks a default that matches the provider credential it finds in your environment — Anthropic key → Claude, Gemini key → Gemini Flash, etc. The picker now selects a provider-appropriate model for Mistral, DeepSeek, xAI, Together, Perplexity, and Fireworks too (see the full 14-row table). When no cloud key is present, resolve_default_model() prefers a reachable local model (e.g. ollama/llama3.2) before falling back to the terminal default (gpt-4o-mini). A cloud-key provider always wins over the local model. See Default Model Resolution for the full ladder.
Best Practices
In CI, set credentials before invoking
In CI, set credentials before invoking
Set
OPENAI_API_KEY (or the provider key for your model) as a repository secret, then reference it in your workflow env block. This is the recommended approach — no credential files in your repo, no interactive prompts:Test your setup with a quick prompt before piping through automation
Test your setup with a quick prompt before piping through automation
Run
praisonai run "ping" manually before wiring the command into a pipeline or CI job. A successful response confirms credentials are configured and the model is reachable.Skip the smoke test in CI
Skip the smoke test in CI
The smoke test is convenient locally but wastes a token round-trip in CI. Skip it with
--no-verify on both setup and setup wizard.Related
Setup Wizard
Interactive wizard for configuring LLM provider credentials
Run Command
Run agents from files or prompts
Code Command
Code assistant — first-run credential gate
Chat Command
Chat mode — first-run credential gate
Keyless Local-First Run
Zero-config runs against a local Ollama or OpenAI-compatible model

