Installation

How to install and configure the TurboAPI SDK.

Requirements

  • Node.js 18+
  • npm 9+ or pnpm 8+ or yarn 1.22+

Install the SDK

npm install @turboapiai/sdk

Configuration

Create a .env file in your project root:

TURBOAPI_API_KEY=your_api_key_here
TURBOAPI_BASE_URL=https://api.turboapi.ai/api/v1

TypeScript Support

The SDK includes full TypeScript support out of the box:

import { TurboAPIClient } from '@turboapiai/sdk';

const client = new TurboAPIClient({
  apiKey: process.env.TURBOAPI_API_KEY!,
});

// Type-safe API calls
const task = await client.call.createAndWait('api-slug', {
  prompt: 'A cute cat',
});

Framework Integration

Next.js

// lib/turboapi.ts
import { TurboAPIClient } from '@turboapiai/sdk';

export const client = new TurboAPIClient({
  apiKey: process.env.TURBOAPI_API_KEY!,
});

Nuxt

Create a client plugin:

// plugins/turboapi.client.ts
import { TurboAPIClient } from '@turboapiai/sdk';

export default defineNuxtPlugin(() => {
  const client = new TurboAPIClient({
    apiKey: useRuntimeConfig().public.turboapiApiKey,
  });
  return {
    provide: { turboapi: client },
  };
});

Verifying Installation

Run a quick test to verify your installation:

import { TurboAPIClient } from '@turboapiai/sdk';

const client = new TurboAPIClient({
  apiKey: process.env.TURBOAPI_API_KEY,
});

// Browse available APIs
const apis = await client.apis.list();
console.log(apis);
Need help? Check our examples or contact support.