feat: migrate Requesty provider to AI SDK (@requesty/ai-sdk) #11350
+588
−366
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Migrate the Requesty provider from the raw OpenAI client to the dedicated
@requesty/ai-sdkpackage using the Vercel AI SDK pattern, consistent with other migrated providers (DeepSeek, xAI, Fireworks, etc.).Changes
New Files
src/types/requesty-ai-sdk.d.ts— Type declarations for@requesty/ai-sdk(workaround for a packaging issue where the.d.tsfilename contains a hash)Modified Files
src/api/providers/requesty.ts— RewroteRequestyHandlerto usecreateRequestyfrom@requesty/ai-sdkwithstreamText/generateTextfrom theaipackagesrc/api/providers/__tests__/requesty.spec.ts— Updated tests to mock AI SDK instead of raw OpenAI clientsrc/package.json— Added@requesty/ai-sdk ^3.0.0dependencyKey Migration Details
openai(raw client)@requesty/ai-sdk+ai(Vercel AI SDK)new OpenAI({ baseURL, apiKey })createRequesty({ baseURL, apiKey, headers, compatibility })client.chat.completions.create()→ manual chunk parsingstreamText()→processAiSdkStreamPart()(shared utility)client.chat.completions.create()→ manual response parsinggenerateText()convertToOpenAiMessages()convertToAiSdkMessages()tool_call_partialchunksconvertToolsForAiSdk()withtool-input-start/delta/endeventshandleOpenAIError()handleAiSdkError()anthropicopenaireasoning_effort+thinkingparamsproviderOptions.requesty.reasoningEffort(supports effort strings and budget token counts)requesty: { trace_id, extra }in request bodyproviderOptions.requesty.extraBody.requestyRequestyUsagevia raw OpenAI responseRequestyProviderMetadataviaresult.providerMetadataisAiSdkProvider()false)trueTest Results
Important
Migrate Requesty provider to
@requesty/ai-sdk, updatingRequestyHandlerand tests to use new SDK functions and error handling.RequestyHandlerinrequesty.tsto usecreateRequestyfrom@requesty/ai-sdk.streamText()andgenerateText()fromaipackage.handleAiSdkError().requesty.spec.tsto mock@requesty/ai-sdkandaipackage functions.requesty-ai-sdk.d.tsfor type declarations of@requesty/ai-sdk.@requesty/ai-sdk ^3.0.0topackage.json.This description was created by
for 1a87e92. You can customize this summary. It will automatically update as commits are pushed.