Use Vercel AI SDK with the Straitly API
Use Vercel AI SDK with Straitly in 5 steps: install @ai-sdk/openai, set the base URL to https://api.straitly.ai/v1 and pass your Straitly key. Claude Sonnet 5.5 then costs $1.20 in and $6.00 out per 1M tokens, 40% under its list price of $2.00 and $10.00.[1][3]
Updated
- Setting
- Client constructor
- Base URL
- https://
api.straitly.ai/ v1 - API key
- sk-YOUR_KEY
- API format
- OpenAI-compatible
- Connect with
- TypeScript client
Your prompts, files and workflow stay as they are. From Vercel AI SDK's docs, checked 16 November 2026[1]
Vercel AI SDK in 5 steps.
Replace sk-YOUR_KEY with your own key from the Keys page. Setting lives in Client constructor, base URL https://api.straitly.ai/v1.
Step 1: Get a Straitly key
Sign up with email or Google, add credits from $5 (no subscription, no minimum), then create a key on the Keys page. It starts with sk-. Keep it private.
Step 2: Install the library
Install Vercel AI SDK in your project.
Terminal
npm install ai @ai-sdk/openai npm install --save-dev tsx typescript @types/nodeStep 3: Set your key
Keep the key in an environment variable on the server that runs your code, never in browser code.
Terminal · Mac / Linux
export STRAITLY_API_KEY="YOUR_STRAITLY_API_KEY"Step 4: Point the client at Straitly
Use straitly.chat(modelId), not straitly(modelId). The default OpenAI provider factory uses Responses in AI SDK 5 and later. Keep this code on the server so the key is never shipped to a browser.
TypeScript · example.ts
import { createOpenAI } from "@ai-sdk/openai"; import { generateText } from "ai"; async function main() { const straitly = createOpenAI({ baseURL: "https://api.straitly.ai/v1", apiKey: process.env.STRAITLY_API_KEY!, }); const { text } = await generateText({ model: straitly.chat("claude-sonnet-5-5"), prompt: "Say hello in one sentence.", }); console.log(text); } main().catch(console.error);Step 5: Run it
Run the file. It prints one sentence from the model. Change the model ID to switch models.
Terminal
npx tsx example.ts
Checked against Vercel AI SDK's own docs, 16 November 2026
- Vercel AI SDK reference[1] (ai-sdk.dev)
Config names and menu paths match these pages as of the date shown. If Vercel AI SDK changes them, its docs win.
What happens to a Vercel AI SDK request?
Two settings change in Vercel AI SDK: where requests go and which key pays for them. Everything else, from your prompts to your workflow, stays as it is.
Vercel AI SDK, as it is
Your prompts, files and workflow stay as they are. The request leaves in the same format as before.
One address, one key
It goes to
https://api.straitly.ai/v1with your Straitly key. That is the whole setup.[1]The same models
The key reaches 117 models. You ask for each one by its model ID.[4]
A smaller bill
Claude Sonnet 5.5 for 10M input tokens and 1M output tokens costs $18.00 against $30.00 at list.[3]
Vercel AI SDK on Straitly in numbers
- 5
- Steps to connect Vercel AI SDK[1]
- 40%
- Straitly under the provider's list price, on most models[2]
- $18.00
- Claude Sonnet 5.5 for 10M input tokens and 1M output tokens, against $30.00 at list[3]
- 117
- Models one key reaches from Vercel AI SDK[4]
- $5
- Smallest top-up. No subscription and no minimum[4]
- $0
- Charged for failed requests[2]
- 98 of 103
- Models with a list price that are at least 40% under it[3]
- 134 of 145
- Models priced under the lowest OpenRouter seller[3]
Vercel AI SDK questions.
Ask a question- Yes. Pass https://api.straitly.ai/v1 as the base URL and your Straitly key as the API key. Keep /v1 at the end.
- Any of the 117 models on the models page. The example uses claude-sonnet-5-5.
- On 2026-11-25 Straitly charged $1.20 input and $6.00 output per 1M tokens for Claude Sonnet 5.5, against a list price of $2.00 and $10.00: 40% under list on input and output alike.
- No. Credits are prepaid, failed requests cost nothing, and there is no subscription, minimum or fee to add credits.
Sources
Setup steps follow Vercel AI SDK's own documentation, read on the date shown. Prices come from Straitly's public catalog.
What each source says
- [1] Vercel AI SDK reference
- The library's own reference for the client used in this example.
- [2] Straitly pricing
- Billed per token at the pooled rate, 40% under the provider's published rate on most models, with nothing added on top. Failed requests cost nothing. No subscription, no minimum.
- [3] Straitly public catalog
- Every model ID with Straitly's price, the lab's official list price where one is published, and the lowest OpenRouter seller including its 5.5% credit fee.
- [4] Straitly home page
- One OpenAI-compatible API for 117 models. Sign up with email or Google, top-ups from $5 with no card or platform fee, base URL https://api.straitly.ai/v1, and requests move to another provider serving the same model if one goes down.
Which other tools use the same key?
- Claude CodeAnthropic Messages. Env vars or settings.json.
- CursorOpenAI-compatible. Settings, no script.
- CodexOpenAI Responses. config.toml provider.
- OpenCodeOpenAI-compatible. opencode.json provider.
- ClineOpenAI-compatible. Settings, no script.
- Claude appAnthropic Messages. Developer menu gateway.
- HermesOpenAI-compatible. Custom endpoint.
- OpenClawOpenAI-compatible. Custom provider.
- OpenAI SDKOpenAI-compatible. Python client.
- Anthropic SDKAnthropic Messages. Python client.
- LangChainOpenAI-compatible. Python client.
- LlamaIndexOpenAI-compatible. Python client.
Start with one request.
Prepaid, no subscription, no minimum. 40% under list on most models you reach from Vercel AI SDK.