Releases: AlexAnys/ai-sub-auth
Releases · AlexAnys/ai-sub-auth
v0.2.0 — AI Facade, Bug Fixes & Subscription Reality Docs
What's New
AI Facade — The Simplest Integration API
New AI class that auto-detects your subscription and provides the simplest possible API:
from ai_sub_auth import AI
ai = AI() # auto-detects ChatGPT Plus OAuth token or API key env vars
ai.connect() # OAuth login or API key verification
result = ai.chat_sync("Hello!") # sync, safe in any context
result = await ai.chat("Hello!") # async- Auto-detection: Codex OAuth token →
ANTHROPIC_API_KEY→OPENAI_API_KEY→ Gemini → DeepSeek → OpenRouter - Sync/Async dual API:
chat_sync()handles nested event loops (FastAPI, Jupyter) via threading - Multi-turn conversations:
messagesparameter supported across all 4 provider APIs - Subscription status:
ai.statusreturns connection state, provider, token expiry, reauth needs
Bug Fixes
- Gemini system prompt — Now uses native
system_instructionfield (was faking with user/model conversation) - OAuth token exchange — Validates error field before accessing tokens in both exchange and refresh
- skills.py diversity —
seen_skillsset properly synced when replacing suggestions - API key validation —
LLMClientraisesAuthErrorimmediately if key is missing
Code Quality
- Narrowed broad
except Exception: passto specific exceptions withwarnings.warn() - Type hints added to all internal
_chat_*methods - Removed hardcoded fallback model names (explicit model required)
- File lock failures now warn instead of silently passing
Documentation
- Subscription Reality (2026) — Honest table showing which subscriptions can actually be bridged (only OpenAI Codex OAuth = zero extra cost; Claude/Gemini = API key only)
- Anti-patterns — Don't bridge Claude Pro/Max or Gemini subscriptions via OAuth
- AGENT.md — New TRANSFORM and EXTRACT implementation examples, Provider Selection Guide, Principle #7 (Subscription-first)
- README — AI Facade as recommended entry point, updated quick start examples
Files Changed
| File | Change |
|---|---|
ai_sub_auth/facade.py |
NEW (264 lines) |
ai_sub_auth/api_client.py |
Gemini fix, messages param, type hints |
ai_sub_auth/oauth_flow.py |
Error field validation |
ai_sub_auth/token_store.py |
Narrow exceptions, lock warnings |
ai_sub_auth/skills.py |
Diversity bug fix |
ai_sub_auth/models.py |
Import cleanup |
ai_sub_auth/__init__.py |
New exports |
AGENT.md |
Subscription reality, examples |
README.md / README_CN.md |
Full docs update |
Full Changelog: f389deb...v0.2.0