feat(openai-auth): add OpenAI Max device-code authentication and unified prompt caching helpers

This commit is contained in:
2026-05-14 11:27:41 +00:00
parent cdf1e2bd99
commit 9ee5990321
14 changed files with 2064 additions and 513 deletions
+2
View File
@@ -10,6 +10,7 @@ The package is a **provider registry** built on the Vercel AI SDK (`ai` v6). The
- Providers: anthropic, openai, google, groq, mistral, xai, perplexity, ollama
- Anthropic prompt caching via `wrapLanguageModel` middleware (enabled by default)
- Custom Ollama provider implementing `LanguageModelV3` directly (for think, num_ctx support)
- OpenAI ChatGPT/Max device-code auth in `smartai.auth.openai.ts`; `openAiMaxAuth` routes OpenAI models to the ChatGPT Codex backend
### Subpath Exports
- `@push.rocks/smartai/vision``analyzeImage()` using `generateText` with image content
@@ -43,6 +44,7 @@ The package is a **provider registry** built on the Vercel AI SDK (`ai` v6). The
- `qenv.getEnvVarOnDemand()` returns a Promise — must be awaited in tests
- OpenAI reasoning options belong in AI SDK `providerOptions`, not model construction options
- SmartAI accepts OpenAI model IDs as plain strings, including `gpt-5.5`
- ChatGPT-authenticated OpenAI model calls use `https://chatgpt.com/backend-api/codex` plus bearer access token and `ChatGPT-Account-ID`, not `https://api.openai.com/v1`
## Testing