Installation
How to install and configure the TurboAPI SDK.
Installation
Requirements
- Node.js 18+
- npm 9+ or pnpm 8+ or yarn 1.22+
Install the SDK
npm install @turboapi/sdk
pnpm add @turboapi/sdk
yarn add @turboapi/sdk
bun add @turboapi/sdk
Configuration
Create a .env file in your project root:
TURBOAPI_API_KEY=your_api_key_here
TURBOAPI_BASE_URL=https://api.turboapi.ai/v1
TypeScript Support
The SDK includes full TypeScript support out of the box:
import { TurboAPI } from '@turboapi/sdk';
const client = new TurboAPI({
apiKey: process.env.TURBOAPI_API_KEY!,
});
// Type-safe API calls
const result = await client.images.generate({
model: 'dall-e-3',
prompt: 'A cute cat',
});
Framework Integration
Next.js
// lib/turboapi.ts
import { TurboAPI } from '@turboapi/sdk';
export const client = new TurboAPI({
apiKey: process.env.TURBOAPI_API_KEY!,
});
Nuxt
Add to nuxt.config.ts:
export default defineNuxtConfig({
modules: ['@turboapi/nuxt'],
runtimeConfig: {
turboapiApiKey: process.env.TURBOAPI_API_KEY,
},
});
Verifying Installation
Run a quick test to verify your installation:
import { TurboAPI } from '@turboapi/sdk';
const client = new TurboAPI({
apiKey: process.env.TURBOAPI_API_KEY,
});
// List available models
const models = await client.models.list();
console.log(models);