Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Feb 9, 2026

Summary

Migrate the Requesty provider from the raw OpenAI client to the dedicated @requesty/ai-sdk package 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.ts filename contains a hash)

Modified Files

  • src/api/providers/requesty.ts — Rewrote RequestyHandler to use createRequesty from @requesty/ai-sdk with streamText/generateText from the ai package
  • src/api/providers/__tests__/requesty.spec.ts — Updated tests to mock AI SDK instead of raw OpenAI client
  • src/package.json — Added @requesty/ai-sdk ^3.0.0 dependency

Key Migration Details

Aspect Before After
SDK openai (raw client) @requesty/ai-sdk + ai (Vercel AI SDK)
Provider init new OpenAI({ baseURL, apiKey }) createRequesty({ baseURL, apiKey, headers, compatibility })
Streaming client.chat.completions.create() → manual chunk parsing streamText()processAiSdkStreamPart() (shared utility)
Completion client.chat.completions.create() → manual response parsing generateText()
Messages convertToOpenAiMessages() convertToAiSdkMessages()
Tools Raw OpenAI tool format with tool_call_partial chunks convertToolsForAiSdk() with tool-input-start/delta/end events
Error handling handleOpenAIError() handleAiSdkError()
Model params format anthropic openai
Reasoning Manual reasoning_effort + thinking params providerOptions.requesty.reasoningEffort (supports effort strings and budget token counts)
Trace metadata requesty: { trace_id, extra } in request body providerOptions.requesty.extraBody.requesty
Cache metrics Parsed from RequestyUsage via raw OpenAI response Extracted from RequestyProviderMetadata via result.providerMetadata
isAiSdkProvider() Not implemented (defaults to false) Returns true

Test Results

  • 17/17 Requesty provider tests passing
  • 5376 total tests passing across the monorepo

Important

Migrate Requesty provider to @requesty/ai-sdk, updating RequestyHandler and tests to use new SDK functions and error handling.

  • Behavior:
    • Migrate RequestyHandler in requesty.ts to use createRequesty from @requesty/ai-sdk.
    • Replace manual chunk parsing with streamText() and generateText() from ai package.
    • Update error handling to use handleAiSdkError().
  • Tests:
    • Update requesty.spec.ts to mock @requesty/ai-sdk and ai package functions.
    • Ensure tests cover new behavior and error handling.
  • Types:
    • Add requesty-ai-sdk.d.ts for type declarations of @requesty/ai-sdk.
  • Dependencies:
    • Add @requesty/ai-sdk ^3.0.0 to package.json.

This description was created by Ellipsis for 1a87e92. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Feb 9, 2026
Migrate the Requesty provider from the raw OpenAI client to the dedicated
@requesty/ai-sdk package using the Vercel AI SDK pattern, consistent with
other migrated providers (DeepSeek, xAI, Fireworks, etc.).

Changes:
- Replace OpenAI client with createRequesty from @requesty/ai-sdk
- Use streamText/generateText from 'ai' package for streaming and completion
- Use shared AI SDK utilities (convertToAiSdkMessages, processAiSdkStreamPart,
  convertToolsForAiSdk, mapToolChoice, handleAiSdkError)
- Map reasoning effort and budget to Requesty's providerOptions.reasoningEffort
- Pass trace_id and mode metadata via providerOptions.requesty.extraBody
- Extract cache metrics from RequestyProviderMetadata via providerMetadata
- Switch getModelParams format from 'anthropic' to 'openai'
- Add isAiSdkProvider() returning true
- Add type declarations for @requesty/ai-sdk (packaging workaround)
- Update all tests to mock AI SDK instead of raw OpenAI client
@daniel-lxs daniel-lxs force-pushed the migrate-requesty-to-ai-sdk branch from b5539ce to 1a87e92 Compare February 9, 2026 23:02
@roomote
Copy link
Contributor

roomote bot commented Feb 9, 2026

Rooviewer Clock   See task

Reviewed. No issues found. The migration follows established AI SDK provider patterns consistently and is well-structured.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 9, 2026
@hannesrudolph hannesrudolph merged commit 7a38b99 into main Feb 9, 2026
10 checks passed
@hannesrudolph hannesrudolph deleted the migrate-requesty-to-ai-sdk branch February 9, 2026 23:29
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Feb 9, 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 lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants