Skip to content

Type to search the docs and the model list.

SDKs

The JavaScript and Python helpers for eWest jobs and webhooks: what they cover (not published yet).

Not published yet. The eWest SDKs are finished and tested but are not on npm or PyPI, and this page is an outline of what they will contain. Until then use the REST API with any HTTP client; every call below has a plain HTTP equivalent in these docs.

There are two small helper libraries, one for JavaScript (Node 18 or newer, no dependencies, TypeScript types included) and one for Python (3.9 or newer, standard library only). They cover the async jobs (video, music, sound and 3D) and webhook verification. For chat, embeddings and images, use the OpenAI or Anthropic client libraries pointed at https://api.ewest.ai/v1: see Developer tools.

The client

, JavaScript, Python
JavaScriptPython
Createnew Ewest(options)Ewest(api_key=None, ...)
API keyapiKey, default process.env.EWEST_KEYapi_key, default the EWEST_KEY variable
Base URLbaseUrl, default https://api.ewest.aibase_url, default https://api.ewest.ai
RetriesmaxRetries (default 2)max_retries (default 2)
Timeouttimeouttimeout (60 s per socket operation)

A 429 is retried with backoff, honouring Retry-After. 5xx answers and network errors are retried only for reads, because a failed POST may already have started a paid job. A 402 is never retried.

Starting and following jobs

Task, JavaScript, Python, REST
TaskJavaScriptPythonREST
Start a videovideos.generate(params)videos.generate(model, prompt, ...)POST /v1/videos/generations
Start music or soundaudio.generate(params)audio.generate(model, prompt, ...)POST /v1/audio/generations
Start a 3D modelthreeD.generate(params)three_d.generate(model, ...)POST /v1/3d/generations
Start and waitgenerateAndWait(params, options)generate_and_wait(model, prompt, ...)start, then poll
Read a jobjobs.get(job)jobs.get(job)GET /v1/jobs/{id}
List jobsjobs.list({ limit })jobs.list(limit)GET /v1/jobs
Wait for the endjobs.wait(job, options)jobs.wait(job, ...)poll
Live progressjobs.stream(job)jobs.stream(job)GET /v1/jobs/{id}/events

A job is a plain object with id, status, progress, eta_seconds, input, output, error and usage, as described in Jobs and webhooks. wait throws JobFailedError when the job ends failed and JobTimeoutError when your own timeout passes first; stream reconnects by itself if the connection drops.

Verifying webhooks

, JavaScript, Python
JavaScriptPython
Verify a deliveryverifyWebhook(payload, headers, secret, options)verify_webhook(payload, headers, secret, ...)
Import from@ewest/sdk/webhooksewest
Resultthe finished job, parsedthe finished job, parsed
On a bad signaturethrows WebhookVerificationErrorraises WebhookVerificationError

Pass the raw request body, not parsed JSON. The default clock tolerance is 5 minutes. The secret comes from GET /v1/webhooks/secret; see Webhooks for the rules the helpers apply.

Errors

Status, Error class
StatusError class
400BadRequestError
401AuthError
402InsufficientBudgetError
403PermissionDeniedError
404NotFoundError
429RateLimitError (has retryAfter / retry_after)
5xxServerError
no answerAPIConnectionError

HTTP errors carry status, type, code, param and the x-request-id of the call: quote it when you ask for help. They all extend EwestError; see Errors for the codes.

Not in the SDKs yet

  • Cancelling a job (POST /v1/jobs/{id}/cancel) and the Idempotency-Key header: call the REST API for these (Jobs and webhooks).
  • Webhook secret and delivery-log calls (/v1/webhooks/secret, /v1/jobs/{id}/webhooks).
  • Chat, images and embeddings: use the OpenAI or Anthropic libraries.

OpenAPI

For other languages, generate a client from the OpenAPI 3.1 spec: it describes every endpoint, field and error.