Interfaces

SDKs

Use the official Skytells SDKs for type-safe, simplified access to all Skytells APIs.

Official SDKs

Skytells currently provides 3 official SDKs:

All official SDKs are designed to keep authentication, request handling, and model execution consistent across environments.


TypeScript SDK

Installation

npm install skytells
pnpm add skytells
yarn add skytells

Quick Start

import { createClient } from 'skytells';

const client = createClient(process.env.SKYTELLS_API_KEY);

// List available models
const models = await client.listModels();
console.log(models);

// Create a prediction
const prediction = await client.predict({
  model: 'skytells/truefusion',
  input: { prompt: 'A mountain landscape at dawn' },
});

console.log(prediction.output);

Automatic API Routing

One of the key advantages of the SDK is automatic routing. You don't need to choose between api.skytells.ai and edge.skytells.ai — the SDK picks the right endpoint based on the model and service:

// The SDK routes this to the correct endpoint automatically
const prediction = await client.predict({
  model: 'skytells/truefusion',
  input: { prompt: 'Hello world' },
});

No need to manage base URLs or switch between endpoints manually.


Creating Predictions

const prediction = await client.predict({
  model: 'skytells/truefusion',
  input: {
    prompt: 'A futuristic cityscape at sunset',
    aspect_ratio: '16:9',
    number_of_images: 3,
  },
});

// Poll for completion
const result = await client.getPrediction(prediction.id);
console.log(result.status); // "succeeded"
console.log(result.output); // Array of image URLs

Listing Models

const models = await client.listModels();

for (const model of models) {
  console.log(`${model.name} (${model.id}): ${model.description}`);
}

Error Handling

import { createClient, SkytellsError } from 'skytells';

const client = createClient(process.env.SKYTELLS_API_KEY);

try {
  const prediction = await client.predict({
    model: 'skytells/truefusion',
    input: { prompt: 'Hello' },
  });
} catch (error) {
  if (error instanceof SkytellsError) {
    console.error(`API Error: ${error.message} (${error.status})`);
  }
}

SDK vs Direct API

SDKDirect API
AuthenticationHandled automaticallyManual x-api-key header
RoutingAuto-selects Standard or EdgeYou choose the base URL
Type safetyLanguage-native SDK types and helpersNone (raw JSON)
SerializationAutomaticManual JSON parse/stringify
Error handlingTyped error classesRaw HTTP status codes

For most use cases, the SDK is the recommended way to interact with Skytells. Use the direct APIs when you need full control over the HTTP layer or are working in a language without an official SDK.


Full Documentation

Read the full guides and references for each SDK:


More SDKs

The .NET SDK is coming soon. In the meantime, you can use the APIs directly from any language.

How is this guide?

On this page