npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

skytells

v1.0.2

Published

Official Skytells JavaScript/TypeScript SDK - Edge compatible

Downloads

46

Readme

Skytells JavaScript/TypeScript SDK

The official JavaScript/TypeScript SDK for interacting with the Skytells API. Edge-compatible with Cloudflare Pages, Vercel Edge Functions, and more.

Installation

npm install skytells
# or
yarn add skytells
# or
pnpm add skytells

Quick Start

Obtaining an API Key

To obtain an API key, follow these steps:

  1. Log in to your Skytells account at https://www.skytells.ai/auth/signin
  2. Navigate to your dashboard and go to the API Keys section at https://www.skytells.ai/dashboard/api-keys
  3. Click on "Generate New API Key"
  4. Give your API key a descriptive name (e.g., "Production API Key", "Development API Key")
  5. Copy the generated API key immediately - you won't be able to see it again!

Making Predictions

import { createClient } from 'skytells';

// Initialize the client with your API key
const skytells = createClient('your-api-key-here');

// Make a prediction
async function makePrediction() {
  try {
    const prediction = await skytells.predict({
      model: 'model-name',
      input: {
        prompt: 'Your prompt here'
      }
    });
    
    console.log('Prediction ID:', prediction.id);
    console.log('Status:', prediction.status);
    console.log('Output:', prediction.output);
  } catch (error) {
    console.error('Error making prediction:', error);
  }
}

// List available models
async function listModels() {
  try {
    const models = await skytells.listModels();
    console.log('Available models:', models);
  } catch (error) {
    console.error('Error listing models:', error);
  }
}

// Get a prediction by ID
async function getPrediction(id) {
  try {
    const prediction = await skytells.getPrediction(id);
    console.log('Prediction:', prediction);
  } catch (error) {
    console.error('Error getting prediction:', error);
  }
}

Edge Compatibility

This SDK is fully compatible with edge environments including:

  • Cloudflare Workers and Pages
  • Vercel Edge Functions
  • Netlify Edge Functions
  • Deno Deploy
  • Any environment with Fetch API support

To use a custom API endpoint or proxy:

import { createClient } from 'skytells';

// Use a custom API endpoint or proxy
const client = createClient('your-api-key', {
  baseUrl: 'https://your-proxy.example.com/v1'
});

API Reference

Creating a Client

import { createClient } from 'skytells';

// With API key (authenticated)
const client = createClient('your-api-key');

// Without API key (unauthenticated, limited functionality)
const unauthenticatedClient = createClient();

// With options
const clientWithOptions = createClient('your-api-key', {
  baseUrl: 'https://api.skytells.ai/v1', // Custom API URL
  timeout: 30000 // Custom timeout in ms
});

Predictions

Make a Prediction

const prediction = await client.predict({
  model: 'model-name',
  input: {
    // Model-specific inputs
    prompt: 'Your prompt here',
    // Other parameters...
  }
});

Get a Prediction by ID

const prediction = await client.getPrediction('prediction-id');

Stream a Prediction

const prediction = await client.streamPrediction('prediction-id');

Cancel a Prediction

const prediction = await client.cancelPrediction('prediction-id');

Delete a Prediction

const prediction = await client.deletePrediction('prediction-id');

Models

List All Models

const models = await client.listModels();

TypeScript Support

This SDK is built with TypeScript and provides full type definitions for all methods and responses.

Error Handling

All API methods return promises that may reject with a SkytellsError. The SDK parses API error responses into this structured format:

import { createClient, SkytellsError } from 'skytells';

try {
  const prediction = await client.predict({
    model: 'model-name',
    input: { prompt: 'Your prompt' }
  });
} catch (error) {
  if (error instanceof SkytellsError) {
    console.error('Error message:', error.message);
    console.error('Error ID:', error.errorId);      // Example: "VALIDATION_ERROR"
    console.error('Error details:', error.details);  // Detailed error information
    console.error('HTTP status:', error.httpStatus); // HTTP status code (e.g., 422)
  } else {
    console.error('Unknown error:', error);
  }
}

Common Error IDs

  • VALIDATION_ERROR - Request parameters failed validation
  • AUTHENTICATION_ERROR - Invalid or missing API key
  • RATE_LIMIT_EXCEEDED - Too many requests
  • RESOURCE_NOT_FOUND - The requested resource doesn't exist
  • NETWORK_ERROR - Connection issue with the API
  • REQUEST_TIMEOUT - Request took too long to complete
  • SERVER_ERROR - The server responded with a non-JSON response (e.g., HTML error page)
  • INVALID_JSON - The server returned invalid JSON content

Non-JSON Response Handling

The SDK automatically handles cases when the server doesn't respond with valid JSON:

try {
  const models = await client.listModels();
} catch (error) {
  if (error instanceof SkytellsError) {
    if (error.errorId === 'SERVER_ERROR') {
      console.error('The server returned a non-JSON response:', error.message);
      console.error('Response content excerpt:', error.details);
      // This could indicate a server outage or maintenance
    } else if (error.errorId === 'INVALID_JSON') {
      console.error('The server returned malformed JSON:', error.message);
      console.error('Response content excerpt:', error.details);
      // This could indicate an API bug or server issue
    }
  }
}

Development

# Install dependencies
npm install

# Build the SDK
npm run build

# Run tests
npm test

# Run linting
npm run lint

Changelog

See CHANGELOG.md for the latest changes.

SDK Docs

See SDK Docs for the latest documentation.

License

MIT