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.
Onboarding Flow
Quick Start
Run praisonai without any setup
Y (or press Enter) to launch the setup wizard.Complete setup once
The setup wizard asks for your provider and API key, then stores the credential securely:Credentials are stored in
When one of
OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, or GOOGLE_API_KEY is already exported, the wizard skips the menu and pre-selects that provider — you only confirm.~/.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.Wizard flow (post-#2680)
The wizard moves through three stages: auto-detect, validate, and smoke-test.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 provider menu only appears when no key is detected.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: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
Bothpraisonai (bare) and praisonai run perform a credential check before doing any work.
Credential detection order
| Step | What is checked | Example |
|---|---|---|
| 1. Env vars (fast path) | OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY, GEMINI_API_KEY, GROQ_API_KEY, COHERE_API_KEY | export OPENAI_API_KEY=sk-... |
| 2. Credential store | ~/.praisonai/credentials.json written by praisonai setup (also mirrored to ~/.praisonai/.env) | praisonai setup |
| 3. LLM resolution | resolve_llm_endpoint_with_credentials() — final fallback | Stored OpenAI base URL |
| 4. Setup wizard auto-detection | Same *_API_KEY env vars, offered as pre-selected default when the user is inside the wizard | Detected on wizard entry, not first Agent.start() |
Behaviour by Mode
| Scenario | Old behaviour | New behaviour |
|---|---|---|
| Configured user (env var or stored credential) | Works normally | Works — no extra prompts, no added latency |
New TTY user, no credentials, praisonai | Launched TUI, failed on first LLM call | Auto-detects any provider key already in the environment (confirm to use), otherwise prompts the menu; validates the key; runs a smoke-test with Agent.start(...); prints the reply. |
New TTY user, no credentials, praisonai run "hi" | Ran agent, failed on first LLM call | Same prompt as above; on success continues the run |
CI / piped stdin / --output json | Cryptic LLM failure | Writes error to stderr, exits 1 |
CI / Scripting
In non-interactive environments, PraisonAI exits with code1 and writes to stderr:
not sys.stdin.isatty() or --output json mode.
GitHub Actions example
Skipping the Prompt
Three ways to avoid the setup prompt:| Method | Command / Action |
|---|---|
| Set an env var | export OPENAI_API_KEY=sk-... |
| Run setup ahead of time | praisonai setup |
| Answer “No” at the prompt | Type n → exits 0 with a hint to run praisonai auth login |
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. 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

