
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A Node.js package for interacting with Ollama and Baichuan AI models with flexible API and CLI support
A Node.js package for interacting with Ollama and Baichuan AI models with flexible API and CLI support.
npm install q-ollama
Make sure Ollama service is running (default: http://localhost:11434)
const { QOllama, ProviderType } = require('q-ollama');
// Create instance
const qollama = new QOllama({
provider: ProviderType.OLLAMA,
ollamaBaseUrl: 'http://localhost:11434',
defaultModel: 'qwen3:8b',
debug: true
});
// Quick chat
async function chat() {
const response = await qollama.quickChat('Hello, please introduce yourself');
console.log('AI Response:', response.content);
}
chat();
Set environment variable BAICHUAN_API_KEY or provide API key directly:
const { QOllama, ProviderType } = require('q-ollama');
const qollama = new QOllama({
provider: ProviderType.BAICHUAN,
baichuanApiKey: 'your-api-key-here', // or use environment variable
defaultModel: 'Baichuan2-Turbo'
});
async function chat() {
const response = await qollama.quickChat('Hello');
console.log('Baichuan Response:', response.content);
}
chat();
// Start with Ollama
const qollama = new QOllama({
provider: ProviderType.OLLAMA,
defaultModel: 'qwen3:8b'
});
console.log('Current provider:', qollama.getCurrentProvider()); // ollama
// Switch to Baichuan
qollama.switchProvider({
provider: ProviderType.BAICHUAN,
baichuanApiKey: process.env.BAICHUAN_API_KEY
});
console.log('Switched provider:', qollama.getCurrentProvider()); // baichuan
new QOllama(config: QOllamaConfig)
Configuration options:
interface QOllamaConfig {
provider: ProviderType; // Model provider
ollamaBaseUrl?: string; // Ollama service URL
baichuanApiKey?: string; // Baichuan API key
defaultModel?: string; // Default model
debug?: boolean; // Debug mode
}
chat(messages: ChatMessage[], options?: ChatOptions): Promise<ChatResponse> - Send chat messagesquickChat(prompt: string, options?: ChatOptions): Promise<ChatResponse> - Quick single messageswitchProvider(newConfig: QOllamaConfig): void - Switch model providergetCurrentProvider(): string - Get current providersupportsStreaming(): boolean - Check if streaming is supportedlistModels(): Promise<string[]> - List available modelssetDebug(debug: boolean): void - Set debug modeconst { createQOllama, createOllamaProvider, createBaichuanProvider } = require('q-ollama');
// Quick instance creation
const qollama1 = createQOllama(config);
const qollama2 = createOllamaProvider('http://localhost:11434', true);
const qollama3 = createBaichuanProvider('your-api-key', true);
After installation, use the q-ollama command:
# Using Ollama
q-ollama chat --provider ollama --model qwen3:8b
# Using Baichuan
q-ollama chat --provider baichuan --model Baichuan2-Turbo --key YOUR_API_KEY
q-ollama message "Hello world" --provider ollama --model qwen3:8b
q-ollama list-models --provider ollama
q-ollama --help
Enable debug mode to see detailed request and response information:
const qollama = new QOllama({
provider: ProviderType.OLLAMA,
debug: true // Enable debug
});
// Or enable at runtime
qollama.setDebug(true);
Debug output includes:
BAICHUAN_API_KEY - Baichuan model API keynpm run build
npm test
npm run dev
Check the examples/ directory for complete examples:
node examples/basic-usage.js
MIT
Issues and Pull Requests are welcome!
If you encounter issues:
FAQs
A Node.js package for interacting with Ollama and Baichuan AI models with flexible API and CLI support
We found that q-ollama demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.