Skip to main content
idapt
HomeCodeAI ModelsPricing
Sign inStart free trial
  • Home
  • Pricing
  • AI Models
  • Image models
  • Voice models
  • Video models
  • Rankings
  • New models
  • Model status
  • Multi-Model Chat
  • Agents
  • Computers
  • Drive
  • Automations
  • AI Gateway
  • All features →
  • LLM cost calculator
  • Token counter
  • All free tools →
  • Blog
  • Use cases
  • Comparisons
  • Best of
  • Benchmarks
  • Changelog
  • Help center
  • FAQ
  • Privacy
  • Compare all models
  • Support
  • idapt Code
  • Developers
  • Quickstarts
  • API reference
  • API pricing
  • CLI
  • MCP
  • Downloads
  • Desktop
  • Badges and embeds
© idapt[email protected]TermsPrivacy PolicyLegal noticeReport content
X (Twitter)
Help Center
🧰

JavaScript SDK quickstart

Found this helpful? Share it:

The idapt JavaScript SDK wraps the whole v1 API behind one typed client. It runs in Node, serverless, and the browser, so you write client.chats.create(...) instead of hand-rolling requests 🧰

Install and connect

  1. Install the package: npm install @idapt/sdk.

  2. Create an API key under Settings → Developer. See API keys and scopes.

  3. Connect with your key and start calling methods.

import { connect } from "@idapt/sdk";

const client = await connect({
  apiUrl: "https://idapt.app",
  key: process.env.IDAPT_API_KEY, // uk_...
});

const me = await client.user.me();
console.log(me.email);

Keep the key in an environment variable, never in client-side code you ship to a browser. A key is a full credential that acts as you.

First calls

Start a chat and send a message

const workspaces = await client.workspaces.list();

const chat = await client.chats.create({
  title: "Hello from the SDK",
  workspace_id: workspaces[0].id,
});

const result = await client.chats.sendMessage(chat.id, {
  content: "Summarize the latest AI news in three bullets.",
});

console.log(result.message);

List the available models

const models = await client.models.list();
console.log(models.length, "models available");

Lists come back as plain arrays and single resources as plain objects. The SDK unwraps the { data }envelope for you.

Handle an error

import { NotFoundError, RateLimitError } from "@idapt/sdk";

try {
  await client.chats.get("missing_id");
} catch (err) {
  if (err instanceof NotFoundError) {
    console.log("that chat is gone");
  } else if (err instanceof RateLimitError) {
    console.log("slow down and retry later");
  } else {
    throw err;
  }
}

Each failure throws a typed IdaptError subclass, so you catch only the kinds you care about. See Rate limits and errors for the full set.

Where to go next

  • The REST API reference: the resources and endpoints behind each SDK method.

  • Rate limits and errors: the error classes and per-surface limits.

Related articles

📖

REST API

Authentication, versioning, response shapes, pagination, and errors for the idapt REST API, plus the full endpoint list.

🔑

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.

Up next

Rate limits and errors

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

Was this helpful?