Skip to content

feat: add Poe as an AI provider#12015

Open
kamilio wants to merge 15 commits intoRooCodeInc:mainfrom
kamilio:feat/add-poe-provider
Open

feat: add Poe as an AI provider#12015
kamilio wants to merge 15 commits intoRooCodeInc:mainfrom
kamilio:feat/add-poe-provider

Conversation

@kamilio
Copy link
Copy Markdown

@kamilio kamilio commented Mar 27, 2026

Related GitHub Issue

Closes: #

Roo Code Task Context (Optional)

N/A

Description

Adds Poe as a new AI provider, enabling users to access models through the Poe API.

Key implementation details:

  • Types & schema: Poe added as a dynamic provider with poeApiKey and poeBaseUrl settings, integrated into the discriminated union and provider registries.
  • Backend handler (PoeHandler): Uses ai-sdk-provider-poe SDK with Vercel AI SDK for streaming. Supports reasoning budget (Anthropic-style thinking) and reasoning effort (OpenAI-style) based on model capabilities. Includes tool calling with OpenAI-compatible schema conversion.
  • Model fetcher: Dynamic model fetching from Poe API with in-memory caching, mapping model capabilities (context window, pricing, reasoning support).
  • Settings UI: Poe settings component with API key input, optional base URL, model picker with dynamic model list, and manual refresh button.
  • Cross-cutting fix: Model switch now also clears modelMaxTokens and modelMaxThinkingTokens (previously only cleared reasoningEffort), so new model defaults take effect for all providers.

Design choices:

  • Follows the same patterns as existing dynamic providers (OpenRouter, Requesty, Roo).
  • maxOutputTokens for budget models is derived from info.maxTokens - thinkingBudget when the user hasn't explicitly set a max, ensuring the reasoning budget + text output don't exceed the model's capacity.

Test Procedure

  • Unit tests added: PoeHandler (16 tests covering constructor, getModel, createMessage streaming, reasoning budget/effort, tool passing, completePrompt) and getPoeModels fetcher (5 tests covering model conversion, optional fields, reasoning effort mapping).
  • Existing test fixtures updated: ClineProvider, webviewMessageHandler, and validate specs updated to include the poe router entry.
  • All tests pass: pnpm test
  • Type-check passes: pnpm check-types (14/14 packages)
  • Lint passes: pnpm lint (14/14 packages)

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

poe ts — Roo-Code 2026-03-27 at 17 13 52

poe ts — Roo-Code 2026-03-27 at 17 10 21

poe ts — Roo-Code 2026-03-27 at 17 10 29

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required. Poe should be added to the list of supported providers in user-facing docs.

Additional Notes

The ai-sdk-provider-poe dependency currently uses a local link for development. This needs to be updated to a published npm package before merging.

We support OAuth and we are planning to add support, but it will be a follow-up PR.

kamilio added 7 commits March 27, 2026 07:37
Previously only reasoningEffort was reset on model switch. Now also
clears modelMaxTokens and modelMaxThinkingTokens so the new model's
defaults take effect. Different models within the same provider can have
different reasoning defaults/options.
Add Poe as a dynamic provider with type definitions including:
- Default model ID (claude-sonnet-4) and model info
- Provider settings schema (poeApiKey, poeBaseUrl)
- Integration into discriminated union, modelIdKeysByProvider, and
  MODELS_BY_PROVIDER registry
Add local link to ai-sdk-provider-poe SDK which provides the Poe AI
provider integration for the Vercel AI SDK.
Implement PoeHandler using the ai-sdk-provider-poe SDK with support for:
- Streaming text generation via Vercel AI SDK
- Reasoning budget (Anthropic-style thinking) and reasoning effort
  (OpenAI-style) based on model capabilities
- Dynamic model fetching from the Poe API with caching
- Tool calling with OpenAI-compatible schema conversion
- Error handling with telemetry capture

Wire the handler into the API factory and model cache router.
Add Poe to the router model fetching pipeline so models are fetched
when a Poe API key is configured. Supports both automatic fetch on
provider selection and manual refresh with key/baseUrl overrides.
Add Poe settings component with API key input, base URL configuration,
model picker with dynamic model list from the Poe API, and manual
model refresh. Integrate into ApiOptions provider selection and the
useSelectedModel hook.
Add unit tests for PoeHandler (constructor, getModel, createMessage,
reasoning budget/effort, completePrompt) and getPoeModels fetcher
(model conversion, optional fields, reasoning effort mapping).

Update existing test fixtures to include the poe router entry.
kamilio added 8 commits March 27, 2026 07:43
Replace local link dependency with the published npm package.
Re-export poeDefaultModelId, POE_DEFAULT_BASE_URL, and
getPoeDefaultModelInfo from the SDK instead of hardcoding them.
Bump ai-sdk-provider-poe to ^2.0.15.
The AI SDK's reasoningText promise is always derived from the same
stream parts emitted via fullStream — it can never contain content
that wasn't already yielded. Remove the redundant fallback to match
the openai-compatible provider pattern.
Remove tests for tool passthrough and model ID plumbing that are
already covered by the ai-sdk transform tests and implicitly by
other createMessage tests. Clean up unused imports.
After clicking Refresh Models, the ModelPicker dropdown (powered by
ExtensionStateContext) updated correctly, but the model validation in
ApiOptions still used a stale react-query cache.  This caused newly
fetched models like gpt-5.4 to show "not available" even though they
appeared in the picker.

Invalidate the react-query ["routerModels"] cache on successful Poe
refresh so validation sees the same model list as the dropdown.

Also bumps ai-sdk-provider-poe to ^2.0.17.
Replace local file: references with the pinned registry version and
remove debug canary from extension.ts.
Add poeApiKey, getPoeApiKey, and poeBaseUrl translation keys
to all 17 non-English locale files.
@kamilio kamilio marked this pull request as ready for review March 27, 2026 19:32
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant