feat: add Poe provider#5560
Conversation
🦋 Changeset detectedLatest commit: ae8aa3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| reasoningEffort: ReasoningEffortExtended | undefined, | ||
| ): { thinking_budget?: number; reasoning_effort?: OpenAI.Chat.ChatCompletionCreateParams["reasoning_effort"] } { | ||
| const isAnthropicModel = modelId.startsWith("claude-") | ||
| const isOpenAiModel = modelId.startsWith("gpt-") |
There was a problem hiding this comment.
[WARNING]: isOpenAiModel check misses OpenAI reasoning models
The startsWith("gpt-") check won't match OpenAI's reasoning models like o1, o3, o4-mini, etc. This means reasoning_effort won't be sent for those models when accessed through Poe, even though the model metadata indicates they support it.
Consider also matching o1, o3, o4 prefixes, e.g.:
| const isOpenAiModel = modelId.startsWith("gpt-") | |
| const isOpenAiModel = modelId.startsWith("gpt-") || /^o[1-9]/.test(modelId) |
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (30 files)
|
| const response = await axios.get(modelsUrl.toString(), { headers }) | ||
| const rawModels = response.data.data | ||
|
|
||
| for (const rawModel of rawModels) { |
There was a problem hiding this comment.
[SUGGESTION]: Add a defensive check for rawModels before iterating
If the Poe API returns an unexpected response shape (e.g., response.data.data is undefined or not an array), the for...of loop will throw a TypeError: rawModels is not iterable. While this is caught by the surrounding try/catch, it would silently return empty models with only a console error, making it hard to diagnose.
Consider adding a guard:
| for (const rawModel of rawModels) { | |
| for (const rawModel of rawModels ?? []) { |
Alternatively, validate Array.isArray(rawModels) and log a more descriptive error if the response shape is unexpected.
Context
Poe.com is an AI aggregation product built by Quora, and it's where I work. About six moths ago, Poe launched an OpenAI compatible API offering to compliment their more UI/website focused offering.
A significant chunk of Poe's API usage is coming from Kilocode users, as can be seen on https://poe.com/leaderboard. Currently, Kilocode users who are using Poe are using the existing OpenAI Compatible provider that Kilocode already has. This PR makes it easier to use Kilocode with Poe by adding a Poe provider to Kilocode.
Implementation
The proposed Poe provider follows the common example set by existing providers. A Poe specific fetcher pulls from api.poe.com/v1/models for a list of available models and options. A Poe handler handles requests to api.poe.com/v1/chat/completions. The webview and various config dictionaries were updated with Poe as a provider. There is a new documentation markdown file that reviews how to use Poe as a provider.
Screenshots
This screen shot shows Poe in the drop down list of providers:
This screen shot shows selecting a model from Poe:
How to Test
Get in Touch
I can be emailed at mpeters @ quora dot com. I have discord, but don't use it much. If it would be helpful I can join on the project discord to discuss anything that arises.