TypeScript SDKReference

Constants

Exported constants including base URLs, timeouts, cache settings, and API endpoints.

Base URLs

const API_BASE_URL           = 'https://api.skytells.ai/v1'
const ORCHESTRATOR_BASE_URL  = 'https://orchestrator.skytells.ai'

Timeouts

const HTTP_DEFAULT_REQUEST_TIMEOUT_MS = 60_000
const EDGE_DEFAULT_REQUEST_TIMEOUT_MS = 25_000
ConstantValueDescription
HTTP_DEFAULT_REQUEST_TIMEOUT_MS60000Default request timeout (60 seconds) in non-edge runtimes.
EDGE_DEFAULT_REQUEST_TIMEOUT_MS25000Default request timeout (25 seconds) in edge runtimes.

Model Cache

const PREFETCHED_MODEL_CACHE_TTL_MS   = 600_000  // 10 min
const PREFETCHED_MODEL_CACHE_MAX_SLUGS = 64
const EDGE_PREFETCH_MAX_SLUGS          = 16
ConstantValueDescription
PREFETCHED_MODEL_CACHE_TTL_MS600000Model cache TTL (10 minutes).
PREFETCHED_MODEL_CACHE_MAX_SLUGS64Max cached model slugs (default runtime).
EDGE_PREFETCH_MAX_SLUGS16Max cached model slugs (edge runtime).

See Models for caching details.


Polling

const DEFAULT_POLL_INTERVAL = 5_000
ConstantValueDescription
DEFAULT_POLL_INTERVAL5000Default polling interval (5 seconds) for wait().

Webhooks

const SKYTELLS_WEBHOOK_SIGNATURE_HEADER = 'x-skytells-signature'
ConstantValueDescription
SKYTELLS_WEBHOOK_SIGNATURE_HEADER'x-skytells-signature'Header name for webhook HMAC-SHA256 signature verification.

See Webhooks for signature verification.


ENDPOINTS

Route builders used internally. All paths are relative to API_BASE_URL.

const ENDPOINTS = {
  PREDICT:                  '/predict',
  PREDICTIONS:              '/predictions',
  MODELS:                   '/models',
  MODEL_BY_SLUG:            (slug: string) => `/model/${slug}`,
  PREDICTION_BY_ID:         (id: string)   => `/predictions/${id}`,
  STREAM_PREDICTION_BY_ID:  (id: string)   => `/predictions/${id}/stream`,
  CANCEL_PREDICTION_BY_ID:  (id: string)   => `/predictions/${id}/cancel`,
  DELETE_PREDICTION_BY_ID:  (id: string)   => `/predictions/${id}/delete`,
  CHAT_COMPLETIONS:         '/chat/completions',
  RESPONSES:                '/responses',
  EMBEDDINGS:               '/embeddings',
}
EndpointPathDescription
PREDICT/predictCreate prediction with server-side wait.
PREDICTIONS/predictionsList predictions.
MODELS/modelsList models.
MODEL_BY_SLUG(slug)/models/{slug}Get model by slug.
PREDICTION_BY_ID(id)/predictions/{id}Get prediction by ID.
STREAM_PREDICTION_BY_ID(id)/predictions/{id}/streamStream prediction results.
CANCEL_PREDICTION_BY_ID(id)/predictions/{id}/cancelCancel prediction.
DELETE_PREDICTION_BY_ID(id)/predictions/{id}/deleteDelete prediction.
CHAT_COMPLETIONS/chat/completionsOpenAI-compatible chat.
RESPONSES/responsesResponses API.
EMBEDDINGS/embeddingsEmbeddings API.

Usage

import {
  API_BASE_URL,
  ORCHESTRATOR_BASE_URL,
  HTTP_DEFAULT_REQUEST_TIMEOUT_MS,
  DEFAULT_POLL_INTERVAL,
  SKYTELLS_WEBHOOK_SIGNATURE_HEADER,
} from 'skytells';

console.log(API_BASE_URL);  // 'https://api.skytells.ai/v1'

How is this guide?

On this page