# Use the Vercel AI SDK with Bridge

URL: https://bridge.wekoya.tech/guides/vercel-ai-sdk
Updated: 2026-11-08

**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.

```bash
npm install ai @ai-sdk/openai
```

```typescript
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)
```

- `bridge.chat(model)` calls Chat Completions and carries every Bridge option. Recommended.
- `bridge(model)` calls the [Responses API](https://bridge.wekoya.tech/docs/responses). It works too, statelessly: the SDK sends the whole conversation each time.
- Or use `createOpenAICompatible` from `@ai-sdk/openai-compatible`, which always uses Chat Completions.
- Keep the key on the server, in a route handler or server action. Never in a `NEXT_PUBLIC_` variable.

[Create a free account](https://bridge.wekoya.tech/sign-up)

## 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

- [LangChain with Bridge](https://bridge.wekoya.tech/guides/langchain)
- [Add AI to your app](https://bridge.wekoya.tech/guides/add-ai-to-your-app-nigeria)
