Skip to main content
idapt
HomeAI ModelsExploreResourcesPricing
Sign inUse for Free
  • Home
  • Pricing
  • AI Models
  • Skills
  • Image models
  • Voice models
  • Video models
  • Rankings
  • Multi-Model Chat
  • Agents
  • Computers
  • Drive
  • Automations
  • AI Gateway
  • All features →
  • Blog
  • About
  • Comparisons
  • Benchmarks
  • Model Match
  • Demos
  • Help center
  • FAQ
  • Privacy
  • Support
  • Developers
  • Quickstarts
  • API reference
  • API pricing
  • CLI
  • MCP
  • Migrate
  • Downloads
  • Desktop
© idapt[email protected]TermsPrivacy PolicyLegal noticeReport content
X (Twitter)Discord
Help Center
🔗

OpenAI SDK (JS) with idapt

Found this helpful? Share it:

Set up OpenAI SDK (JS) against idapt's compatible APIs with the steps below. This article and the AI Gateway quickstarts lander render the same shared steps, so they never drift.

OpenAI SDK (JS) with idapt

The canonical three-line diff: baseURL, key, model id.

  1. 1

    Install

    bash
    npm i openai
  2. 2

    Point it at idapt

    ts
    import OpenAI from "openai";
    
    const client = new OpenAI({
      baseURL: "https://idapt.app/api/openai/v1",
      apiKey: process.env.IDAPT_API_KEY,
    });
    
    const reply = await client.chat.completions.create({
      model: "deepseek/deepseek-v4-flash",
      messages: [{ role: "user", content: "Three facts about ravens." }],
    });
  3. 3

    Streaming

    ts
    const stream = await client.chat.completions.create({
      model: "deepseek/deepseek-v4-flash",
      messages: [{ role: "user", content: "Stream a haiku." }],
      stream: true,
    });
    for await (const part of stream) {
      process.stdout.write(part.choices[0]?.delta?.content ?? "");
    }

GOOD TO KNOW

API keys and scopesOpenAI-compatible API referenceOpenRouter-compatible API referenceRate limits and errors

MORE QUICKSTARTS

OpenAI SDK (Python)

Vercel AI SDK

Vercel AI SDK

curl

curl

Related articles

🔑

API keys and scopes

Create a key, choose its scopes, pin it to an API version, rotate it, and cap what it can spend.

🚦

Rate limits and errors

Every error shape the API returns, what each rate limit is, and how to handle a wall in code.

🛡️

Cap what an API key spends

Give every Gateway API key a lifetime, monthly, or daily USD cap, and what a capped-out key returns.

🔗

OpenAI-compatible API

Use idapt's 200+ models from any app that speaks the OpenAI API format.

🔗

OpenAI SDK (Python) with idapt

Point the official OpenAI Python SDK at idapt's compatible API with base_url and run any catalog model unchanged.

🔗

Vercel AI SDK with idapt

Use the Vercel AI SDK with idapt's OpenAI-compatible API: provider setup, streaming, and tool calls with one base-URL swap.

⚡

curl with idapt

curl examples for idapt's three compatible APIs: OpenAI chat completions, Anthropic messages, and OpenRouter completions with one key.

Up next

OpenAI SDK (Python) with idapt

Point the official OpenAI Python SDK at idapt's compatible API with base_url and run any catalog model unchanged.

Was this helpful?