TypeScript SDKReference
Constants
Exported constants including base URLs, timeouts, cache settings, and API endpoints.
SDK Internal Constants: These values are used internally by the SDK. You can import them for custom implementations or testing. Modifying these requires passing custom ClientOptions.
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| Constant | Value | Description |
|---|---|---|
HTTP_DEFAULT_REQUEST_TIMEOUT_MS | 60000 | Default request timeout (60 seconds) in non-edge runtimes. |
EDGE_DEFAULT_REQUEST_TIMEOUT_MS | 25000 | Default 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| Constant | Value | Description |
|---|---|---|
PREFETCHED_MODEL_CACHE_TTL_MS | 600000 | Model cache TTL (10 minutes). |
PREFETCHED_MODEL_CACHE_MAX_SLUGS | 64 | Max cached model slugs (default runtime). |
EDGE_PREFETCH_MAX_SLUGS | 16 | Max cached model slugs (edge runtime). |
See Models for caching details.
Polling
const DEFAULT_POLL_INTERVAL = 5_000| Constant | Value | Description |
|---|---|---|
DEFAULT_POLL_INTERVAL | 5000 | Default polling interval (5 seconds) for wait(). |
Webhooks
const SKYTELLS_WEBHOOK_SIGNATURE_HEADER = 'x-skytells-signature'| Constant | Value | Description |
|---|---|---|
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',
}| Endpoint | Path | Description |
|---|---|---|
PREDICT | /predict | Create prediction with server-side wait. |
PREDICTIONS | /predictions | List predictions. |
MODELS | /models | List 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}/stream | Stream prediction results. |
CANCEL_PREDICTION_BY_ID(id) | /predictions/{id}/cancel | Cancel prediction. |
DELETE_PREDICTION_BY_ID(id) | /predictions/{id}/delete | Delete prediction. |
CHAT_COMPLETIONS | /chat/completions | OpenAI-compatible chat. |
RESPONSES | /responses | Responses API. |
EMBEDDINGS | /embeddings | Embeddings 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?