Skip to content

feat: integrate ai-sdk provider#10467

Merged
sestinj merged 9 commits intocontinuedev:mainfrom
uinstinct:cli-ai-sdk
Feb 18, 2026
Merged

feat: integrate ai-sdk provider#10467
sestinj merged 9 commits intocontinuedev:mainfrom
uinstinct:cli-ai-sdk

Conversation

@uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Feb 12, 2026

Description

Adds a separate ai-sdk provider into openai-adapters for usage in the cli.

Currently supports openai, anthropic, and openrouter.

Usage:

In your config.yaml, add the provider as ai-sdk and model as <provider-name>/<model-name>. Here is an example:

name: Local Config
version: 1.0.0
schema: v1
models:
  - name: Claude via AI SDK
    provider: ai-sdk
    model: anthropic/claude-opus-4-6
    apiKey: <api-key>
  - name: Openai via AI SDK
    provider: ai-sdk
    model: openai/gpt-5
    apiKey: <api-key>
  - name: Openrouter via AI SDK
    provider: ai-sdk
    model: openrouter/z-ai/glm-4.5-air:free
    apiKey: <api-key>

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Add an ai-sdk provider so the CLI can use Vercel AI SDK models (OpenAI, Anthropic, and OpenRouter) for chat and embeddings. Tool calls are converted to AI SDK messages, and tool schemas are normalized for OpenAI strict compatibility.

  • New Features

    • Added AiSdkApi with chat completions (streaming and non-streaming) and embeddings via @ai-sdk/openai, including Anthropic and OpenRouter through OpenAI-compatible endpoints.
    • Accepts model as "provider/model" (e.g., "openai/gpt-4o"); CLI forwards the model.
    • Converts assistant tool_calls to Vercel AI SDK messages, supports tools and tool_choice; streams converted back to OpenAI-style chunks.
    • Normalizes tool parameter schemas for OpenAI strict mode (adds required and disables additionalProperties).
    • Wired into constructLlmApi and types (AiSdkConfig); legacy completions, FIM, and rerank are not supported.
  • Migration

    • In CLI config, set provider: "ai-sdk" and model: "/" (e.g., "openai/gpt-4o", "anthropic/claude-3.5-sonnet", or "openrouter/").
    • Provide apiKey/apiBase and any requestOptions as needed.

Written for commit ec8263d. Summary will update on new commits.

@uinstinct uinstinct marked this pull request as ready for review February 17, 2026 13:53
@uinstinct uinstinct requested a review from a team as a code owner February 17, 2026 13:53
@uinstinct uinstinct requested review from RomneyDa and removed request for a team February 17, 2026 13:53
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 17, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/openai-adapters/src/apis/AiSdk.ts">

<violation number="1" location="packages/openai-adapters/src/apis/AiSdk.ts:165">
P2: finish_reason mapping collapses "length" and "content-filter" into "stop", hiding truncation or content-filter events from OpenAI-style clients.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

refusal: null,
},
finish_reason:
result.finishReason === "tool-calls" ? "tool_calls" : "stop",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: finish_reason mapping collapses "length" and "content-filter" into "stop", hiding truncation or content-filter events from OpenAI-style clients.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/openai-adapters/src/apis/AiSdk.ts, line 165:

<comment>finish_reason mapping collapses "length" and "content-filter" into "stop", hiding truncation or content-filter events from OpenAI-style clients.</comment>

<file context>
@@ -0,0 +1,303 @@
+            refusal: null,
+          },
+          finish_reason:
+            result.finishReason === "tool-calls" ? "tool_calls" : "stop",
+          logprobs: null,
+        },
</file context>
Fix with Cubic

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Feb 18, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 18, 2026
@sestinj sestinj merged commit 8eee3e0 into continuedev:main Feb 18, 2026
50 of 52 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Feb 18, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2026
@uinstinct uinstinct deleted the cli-ai-sdk branch February 18, 2026 05:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants