Inference APIs
Integrations/Framework

Use Inference APIs with Vercel AI SDK

Use @ai-sdk/openai-compatible to create a provider for Inference APIs; then streamText, generateText and tool calling work as with any provider.

Settings

SettingValue
Base URLhttps://api.inferenceapis.com/v1 (also /openai/v1)
API keyFrom API Keys; send as Authorization: Bearer …
Chat model idsopenai/gpt-oss-120b, deepseek-ai/DeepSeek-V4-Flash, zai-org/GLM-5.3-Flash, meta-llama/Llama-3.3-70B-Instruct-Turboall models
Audio model idsopenai/whisper-large-v3 (transcription), hexgrad/Kokoro-82M (speech)

Configuration

Install
npm install ai @ai-sdk/openai-compatible
Provider + streamText
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { streamText } from "ai";

const inferenceapis = createOpenAICompatible({
  name: "inferenceapis",
  baseURL: "https://api.inferenceapis.com/v1",
  apiKey: process.env.INFERENCE_API_KEY,
});

const result = streamText({
  model: inferenceapis("openai/gpt-oss-120b"),
  prompt: "Write a limerick about rate limits.",
});
for await (const chunk of result.textStream) process.stdout.write(chunk);

Verify

Smoke test
node -e "console.log('see snippet')"

Gotchas

  • Use inferenceapis.chatModel(id) if your SDK version distinguishes chat and completion models.

If something fails

401 — key missing or wrong · 402 insufficient_balance — add credits on Billing · 404 model_not_found — check the id against the model list (aliases such as gpt-oss-120b work too) · 503 model_unavailable — the model is being enabled. Full details in the API docs.