
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@izumiapi/gemini-api
Advanced tools
🚧 This package is currently in testing/maintenance phase 🚧
A simple and lightweight wrapper for Google's Gemini AI API that provides session-based chat functionality with automatic conversation history management.
npm install @izumiapi/gemini-api
import { ConnectToGemini } from '@izumiapi/gemini-api';
// Initialize with your Google AI API key
const gemini = new ConnectToGemini({
apiKey: 'your-google-ai-api-key'
});
// Start chatting with session management
const response = await gemini.chatSession({
idSesi: 'user123',
chat: 'Hello, how are you?'
});
console.log(response.result);
new ConnectToGemini({ apiKey })
Parameters:
apiKey (string, required): Your Google AI API keychatSession({ idSesi, chat })Send a message and get a response while maintaining conversation history.
Parameters:
idSesi (string, required): Unique session identifier for conversation trackingchat (string, required): The message to send to GeminiReturns:
{
success: true,
result: "AI response text",
sessions: [...] // Complete conversation history
}
const gemini = new ConnectToGemini({
apiKey: process.env.GOOGLE_AI_API_KEY
});
try {
const response = await gemini.chatSession({
idSesi: 'session-001',
chat: 'Explain quantum computing in simple terms'
});
console.log('AI Response:', response.result);
console.log('Conversation History:', response.sessions);
} catch (error) {
console.error('Error:', error.message);
}
// Different users with separate conversation histories
const user1Response = await gemini.chatSession({
idSesi: 'user-1',
chat: 'What is JavaScript?'
});
const user2Response = await gemini.chatSession({
idSesi: 'user-2',
chat: 'How to cook pasta?'
});
// Continue user-1's conversation
const user1Followup = await gemini.chatSession({
idSesi: 'user-1',
chat: 'Can you give me an example?'
});
Create a .env file:
GOOGLE_AI_API_KEY=your_actual_api_key_here
import dotenv from 'dotenv';
dotenv.config();
const gemini = new ConnectToGemini({
apiKey: process.env.GOOGLE_AI_API_KEY
});
⚠️ Security Note: Never expose your API key in client-side code or commit it to version control. Always use environment variables.
The package includes built-in error handling for common scenarios:
try {
const response = await gemini.chatSession({
idSesi: 'test-session',
chat: 'Hello world!'
});
console.log(response.result);
} catch (error) {
if (error.message.includes('session ID')) {
console.error('Session ID is required');
} else if (error.message.includes('message')) {
console.error('Chat message is required');
} else {
console.error('Unexpected error:', error.message);
}
}
This package uses the gemini-2.0-flash-001 model, which provides:
🚧 Testing/Maintenance Phase
This package is actively being tested and maintained. Features may change, and we recommend:
For questions, issues, or feature requests, please open an issue on our GitHub repository.
Note: This package is not officially affiliated with Google. Google AI and Gemini are trademarks of Google LLC.
FAQs
A module to connect to gemini api.
We found that @izumiapi/gemini-api 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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.