Skip to main content

Overview

Type: Framework or PlatformPrimary Path: OpenAI-compatible defaultSupport Confidence: Recommended integration pattern
For AI Sonar, the most stable default in Vercel AI SDK is the OpenAI-compatible provider. If you specifically need Responses-native behavior, you can switch to the OpenAI provider and keep the same AI Sonar base URL. Treat this page as a recommended integration pattern, not as a guarantee that every helper in Vercel AI SDK is supported by AI Sonar.

Generate Text

Stream Text

Tool Calling

Structured Output

If You Explicitly Need Responses-Native Behavior

Use @ai-sdk/openai-compatible as the safe default for proxy-style integrations. Switch to @ai-sdk/openai only when you explicitly want a provider path built on /v1/responses.

Environment Variables

Best Practices

For third-party gateways and proxy backends, @ai-sdk/openai-compatible is usually the least surprising starting point.
If you need provider behavior tied to /v1/responses, switch the provider package deliberately instead of mixing both patterns in one client.
Never expose your AI Sonar API key in client-side code. Put provider setup in server files or API routes.