Bridge by Wekoya / Guides / Use the Vercel AI SDK with Bridge

Use the Vercel AI SDK with Bridge

In short: Create a provider with createOpenAI({ baseURL, apiKey }) pointed at Bridge and call bridge.chat(model) for Chat Completions. The default bridge(model) uses the Responses API, which Bridge also answers. Streaming, tools and structured output work on every model that supports them, billed in naira.

Updated

npm install ai @ai-sdk/openai
import { createOpenAI } from "@ai-sdk/openai"
import { streamText } from "ai"

const bridge = createOpenAI({
  name: "bridge",
  baseURL: "https://wekoya-api.wekoya.tech/v1",
  apiKey: process.env.WEKOYA_API_KEY,
})

const result = streamText({
  model: bridge.chat("claude-sonnet-5-5"),
  prompt: "Write a welcome message for a Lagos bakery.",
})
for await (const text of result.textStream) process.stdout.write(text)

Create a free account

Common questions

Why use .chat(model) with the AI SDK?

Since AI SDK 5, openai(model) uses OpenAI's Responses API by default. Bridge answers both, but .chat(model) uses Chat Completions, which carries every Bridge option.

Read next