ai-assistant-auth
v1.0.0
Published
CLI authentication tool for AI Assistant Deployment Hub with Ollama Cloud integration
Maintainers
Readme
AI Assistant Authentication CLI
A powerful CLI tool for authenticating with Ollama Cloud and managing AI Assistant configurations. This tool replaces Google Cloud authentication with Ollama Cloud authentication, allowing you to use your self-hosted Ollama agent as a Google-search replacement.
Features
- 🔐 Ollama Cloud OAuth Authentication - Secure browser-based authentication flow
- ⚙️ Configuration Management - Easy setup and management of AI assistant settings
- 🌐 Self-hosted Integration - Connect to your Ollama instance running on OCI
- 📋 Status Monitoring - Check authentication and configuration status
- 🛠️ Global CLI Access - Install globally and use with
npx ai-assistant-auth
Installation
Global Installation (Recommended)
npm install -g ai-assistant-authLocal Installation
npm install ai-assistant-authUsage
Initialize Configuration
ai-auth initSets up the initial configuration file at ~/.ai-assistant/config.json
Authenticate with Ollama Cloud
ai-auth authOpens your browser to authenticate with Ollama Cloud and obtain your API key.
Check Status
ai-auth statusDisplays current authentication status and configuration details.
Manage Configuration
# List all configuration settings
ai-auth config --list
# Get a specific configuration value
ai-auth config --get "assistant.defaultModel"
# Set a configuration value
ai-auth config --set "assistant.defaultModel=llama3.2"Using Your Authenticated Ollama API
After authentication, you can use your OLLAMA_API_KEY with the Ollama client:
Node.js Example
import { Ollama } from "ollama";
const ollama = new Ollama({
host: "https://ollama.com",
headers: {
Authorization: "Bearer " + process.env.OLLAMA_API_KEY,
},
});
const response = await ollama.chat({
model: "llama3.2",
messages: [{ role: "user", content: "Explain quantum computing" }],
stream: true,
});
for await (const part of response) {
process.stdout.write(part.message.content);
}Python Example
import os
from ollama import Client
client = Client(
host="https://ollama.com",
headers={'Authorization': 'Bearer ' + os.environ.get('OLLAMA_API_KEY')}
)
messages = [
{
'role': 'user',
'content': 'Why is the sky blue?',
},
]
for part in client.chat('llama3.2', messages=messages, stream=True):
print(part['message']['content'], end='', flush=True)Environment Variables
After authentication, set your OLLAMA_API_KEY:
export OLLAMA_API_KEY="your-api-key-from-authentication"Commands
| Command | Description |
|---------|-------------|
| ai-auth auth | Authenticate with Ollama Cloud |
| ai-auth init | Initialize configuration |
| ai-auth status | Check authentication status |
| ai-auth config --list | List all configuration |
| ai-auth config --get <key> | Get configuration value |
| ai-auth config --set <key=value> | Set configuration value |
Configuration File
The tool creates a configuration file at ~/.ai-assistant/config.json with default settings:
{
"ollama": {
"baseUrl": "http://localhost:11434",
"cloudEnabled": true
},
"assistant": {
"defaultModel": "llama3.1",
"temperature": 0.7,
"maxTokens": 2048
},
"features": {
"chat": true,
"fileUpload": true,
"camera": true
}
}Development
Building from Source
npm run buildRunning Development Version
npm run devTesting CLI
node dist/cli.js --helpPublishing to npm
To publish updates:
npm login
npm publishLicense
MIT
Author
AI Assistant Deployment Hub
