CLI Authentication
The PaiTIENT Secure Model CLI provides several methods for authentication. This document explains how to authenticate with the CLI for secure access to the API.
Authentication Methods
The CLI supports the following authentication methods:
- Interactive login
- Environment variables
- Configuration file
- Command-line parameters
Interactive Login
The simplest way to authenticate is through the interactive login command:
secure-model loginThis command will prompt you for your Client ID and API Key. After successful authentication, your credentials will be securely stored in the configuration file (~/.paitient/config.json).
Environment Variables
You can authenticate using environment variables:
export PAITIENT_API_KEY="your-api-key"
export PAITIENT_CLIENT_ID="your-client-id"
# Now run commands without explicit authentication
secure-model list deploymentsThis method is particularly useful for CI/CD pipelines and scripts.
Configuration File
The CLI reads credentials from ~/.paitient/config.json if present:
{
"client_id": "your-client-id",
"api_key": "your-api-key"
}You can create or modify this file manually, or use the configure command:
secure-model configureCommand-line Parameters
You can provide credentials directly as command-line parameters:
secure-model list deployments --client-id "your-client-id" --api-key "your-api-key"WARNING
Providing credentials as command-line parameters is not recommended for security reasons. The credentials may be visible in command history or process listings.
Authentication Profiles
The CLI supports multiple authentication profiles for different environments:
# Create a new profile
secure-model configure --profile production
# Use a specific profile
secure-model list deployments --profile productionEach profile has its own set of credentials and configuration stored in the configuration file.
Token Refresh
Authentication tokens are automatically refreshed when needed. You typically don't need to re-authenticate unless you explicitly log out or your API key is revoked.
Logging Out
To remove stored credentials:
secure-model logoutTo log out of a specific profile:
secure-model logout --profile productionSecurity Best Practices
- Never share your API key or include it in public repositories
- Use environment variables for CI/CD pipelines
- Rotate your API keys regularly
- Use different API keys for development and production
- Set appropriate permissions for the configuration file:bash
chmod 600 ~/.paitient/config.json
Service Account Authentication
For automated systems, it's recommended to use a service account with limited permissions:
- Create a service account in your PaiTIENT dashboard
- Assign only the necessary permissions to this account
- Use the service account credentials for your automated processes
MFA Integration
If your account requires multi-factor authentication (MFA), the interactive login will prompt for the MFA code. For non-interactive authentication with MFA-enabled accounts, you'll need to use API keys that were created with MFA verification.
Next Steps
- Learn about CLI Commands
- Explore CLI Examples
- Understand CLI Configuration
- Review Troubleshooting