Authentication
Authentication
The MindSim client requires a valid API Key to make requests. The SDK supports three authentication strategies designed for different environments.
1. Local Development (CLI)
Best for: Local prototyping, exploration, and individual development.
The SDK comes with a CLI tool that handles OAuth authentication via your browser.
- Run the authentication command in your terminal:
- A browser window will open. Log in with your MindSim credentials.
- Once successful, the API key is stored locally in
~/.mindsim/config. - Initialize the SDK without arguments:
2. Environment Variables
Best for: CI/CD pipelines, Docker containers, and production deployments.
The SDK looks for the MINDSIM_API_KEY environment variable. This takes precedence over local configuration files.
3. Constructor Injection
Best for: Applications using secret managers (AWS Secrets Manager, Vault) where keys are retrieved at runtime.
You can pass the API key directly as the first argument to the constructor.
Troubleshooting
If the SDK cannot find an API key in the environment variables, the local config file, or the constructor arguments, it will throw an error:
Error: API Key not found. Please run mindsim auth or pass the key to the constructor.
