Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 2.92 KB

File metadata and controls

77 lines (51 loc) · 2.92 KB

Authentication Setup

The Scenius CLI requires authentication to connect to LLM services. Currently, the CLI supports OpenAI Compatible authentication.

OpenAI Compatible Authentication

This method allows you to connect to OpenAI or any OpenAI-compatible service (such as local LLM servers, alternative providers, etc.).

Interactive Setup

When you first run the CLI, you'll be prompted to select an authentication method. Choose "OpenAI Compatible" and you'll be asked to provide:

  1. API Key: Your OpenAI API key or the key for your compatible service
  2. Base URL (optional): The API endpoint URL (defaults to OpenAI's API if not specified)
  3. Model (optional): The model to use (defaults to gpt-4 if not specified)

Environment Variable Setup

You can also configure authentication using environment variables:

export OPENAI_API_KEY="YOUR_API_KEY"
export OPENAI_BASE_URL="https://api.openai.com/v1"  # Optional
export OPENAI_MODEL="gpt-4"  # Optional

For repeated use, you can add these to your .env file or shell configuration file:

echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.bashrc
source ~/.bashrc

⚠️ Be advised that when you export your API key inside your shell configuration file, any other process executed from the shell can read it.

Persisting Environment Variables with .env Files

You can create a .sceni/.env file in your project directory or in your home directory. Creating a plain .env file also works, but .sceni/.env is recommended to keep Scenius variables isolated from other tools.

Scenius CLI automatically loads environment variables from the first .env file it finds, using the following search order:

  1. Starting in the current directory and moving upward toward /, for each directory it checks:
    1. .sceni/.env
    2. .env
  2. If no file is found, it falls back to your home directory:
    • ~/.sceni/.env
    • ~/.env

Important: The search stops at the first file encountered—variables are not merged across multiple files.

Examples

Project-specific overrides (take precedence when you are inside the project):

mkdir -p .sceni
echo 'OPENAI_API_KEY="your-api-key"' >> .sceni/.env

User-wide settings (available in every directory):

mkdir -p ~/.sceni
cat >> ~/.sceni/.env <<'EOF'
OPENAI_API_KEY="your-api-key"
OPENAI_MODEL="gpt-4"
EOF

Non-Interactive Mode / Headless Environments

When running the Scenius CLI in a non-interactive environment, you cannot use the interactive setup flow. Instead, you must configure authentication using environment variables.

The CLI will automatically detect if it is running in a non-interactive terminal and will require the OPENAI_API_KEY environment variable to be set.

If the OPENAI_API_KEY environment variable is not set in a non-interactive session, the CLI will exit with an error.