Common Skill Utilities
Thư viện dùng chung cho các skills sử dụng Gemini API.
Capabilities
- API Key Management (quản lý API key) – Tự động tìm
GEMINI_API_KEYtừ nhiều nguồn - Vertex AI Support (hỗ trợ Vertex AI) – Chuyển đổi giữa AI Studio và Vertex AI
- Client Helpers (trợ giúp client) – Tự động khởi tạo client phù hợp
Usage
import sys
from pathlib import Path
# Thêm common directory vào path
common_dir = Path(__file__).parent.parent.parent / 'common'
sys.path.insert(0, str(common_dir))
from api_key_helper import get_api_key_or_exit, get_client, get_vertex_config
# Lấy API key
api_key = get_api_key_or_exit()
# Hoặc lấy client tự động
client_info = get_client()
API Key Lookup Order
- Process environment variable (
GEMINI_API_KEY) - Project root
.envfile .claude/.envfile.claude/skills/.envfile- Skill directory
.envfile
Vertex AI Configuration
export GEMINI_USE_VERTEX=true
export VERTEX_PROJECT_ID=your-gcp-project-id
export VERTEX_LOCATION=us-central1
Files
api_key_helper.py– Main utility moduleREADME.md– Detailed documentation
