The HIPS SDK for TypeScript and JavaScript
The HIPS SDK for TypeScript and JavaScript runs image, video, audio and specialist models, and your own imported models, through the HIPS task API. It is one of eight SDKs generated from one API description, hand-finished and checked by one shared conformance suite, so it behaves exactly as the other seven do; only the language's code and idioms differ.
Note
The package name and the method names below are proposals Not decided yet. The eight SDKs are released together, once every one passes the conformance suite; nothing here is installable yet.
RuntimeNode 20 and newer, Deno, Bun, edge runtimes
Repositoryhips-ai/hips-sdk-node, one repository per language underhips-aiImportproposed@hips-ai/sdkPackageproposed@hips-ai/sdkon npm, not yet reserved Not decided yetIdiomscamelCase methods and fields, typed results; errors are classes extending
HipsError.FormsEvery method returns a promise; the same package runs in Node, Deno, Bun and edge runtimes.
The install command appears here when the eight SDKs are published. Until then the package name is a proposal, and no command is printed that would install something else.
The client reads two names from the environment, HIPS_API_KEY and HIPS_BASE_URL, whose value is https://ai.hips.com/v1. An argument given to the client wins over the environment, and an empty argument counts as not given. A client with no key fails when it is constructed, before any request. Your own code reads HIPS_MODEL and passes it as the model, or passes a dep_ deployment id; the SDK sends either exactly as given.
Environment
export HIPS_API_KEY="<a key created in the Console>"export HIPS_BASE_URL="https://ai.hips.com/v1"export HIPS_MODEL="<a catalog model id or a dep_ deployment id>"Keep the key on the server or in a secret store. The SDK never writes it to a file, a keychain or a cache, and never logs it.
A classification task against your own model's deployment, the example every SDK page shares. The input and output shapes are illustrative; the task's real shape is on its task guide.
TypeScript and JavaScript
import { Hips } from "@hips-ai/sdk"; // Reads HIPS_API_KEY and HIPS_BASE_URL (https://ai.hips.com/v1);// fails without a key.const client = new Hips(); const result = await client.tasks.run({ deployment: "dep_...", input: { text: "I was charged twice and nobody has replied." }, requirements: { pool: "approved", pricingMode: "stable" },}); console.log(result.output.label, result.usage.units);console.log(result.meta.costMicros, result.meta.requestId);client.uploads.upload sends a file that is too large to inline: it creates the upload with POST /v1/uploads, puts the bytes to the address the API returned, always a HIPS host over https, and gives you the upl_ id to name in a task's input. Uploads are for task inputs only: the SDK has no way to send model weights.
Your model is imported from its model hub in the Console, never uploaded: the import pins the revision, checks the files, re-saves them as weight files only and signs them (Import and run your model). You deploy the version there, and the SDK takes the dep_ deployment id as given. The SDK never starts an import and never asks for, stores or sends a hub token.
Video, long audio and batched generation are jobs. client.jobs.create answers at once with the job; client.jobs.wait polls client.jobs.get with backoff, honoring the server's suggested interval, until the job is completed, failed, canceled or interrupted. client.jobs.cancel stops one.
One error envelope on every route, mirrored as typed errors, all deriving from a base error that carries the status, type, code, param, the server's message and the request id. Rejected promises with typed errors: if (e instanceof RateLimitError) reads e.retryAfter.
| Status and type | Error |
|---|---|
400 invalid_request_error | InvalidRequestError |
401 authentication_error | AuthenticationError |
402 insufficient_credit | InsufficientCreditError |
403 permission_error | PermissionError |
403 workspace_suspended | WorkspaceSuspendedError |
404 not_found_error | NotFoundError |
429 rate_limit_error | RateLimitError, with the wait from Retry-After |
503 overloaded_error | OverloadedError, with the wait from Retry-After |
500 api_error | ApiError |
| No response | ConnectionError, TimeoutError |
- Status and type
- 400
invalid_request_error - Error
InvalidRequestError
- Status and type
- 401
authentication_error - Error
AuthenticationError
- Status and type
- 402
insufficient_credit - Error
InsufficientCreditError
- Status and type
- 403
permission_error - Error
PermissionError
- Status and type
- 403
workspace_suspended - Error
WorkspaceSuspendedError
- Status and type
- 404
not_found_error - Error
NotFoundError
- Status and type
- 429
rate_limit_error - Error
RateLimitError, with the wait fromRetry-After
- Status and type
- 503
overloaded_error - Error
OverloadedError, with the wait fromRetry-After
- Status and type
- 500
api_error - Error
ApiError
- Status and type
- No response
- Error
ConnectionError,TimeoutError
- Retried: 429 and 503, honoring
Retry-After, and a connection failure before any byte of a response, with exponential backoff and jitter Not decided yet. - Never retried: any other 4xx, and 500.
- An
idempotency-keyis generated for everyclient.tasks.runandclient.jobs.createcall and sent on every attempt, so a retry can never bill twice; you can supply your own. - Redirects are never followed, so a key is never sent to another host.
Do not assume that every failed or retried attempt has the same billing outcome: each result's meta and usage show what that response was charged (Retries and billing outcomes).
Pool, pricing mode, region and fallback are set as client defaults and overridden per call; the SDK writes them as the hips object in the body. A requirement left unset is left out, so the key's defaults from the Console apply. The SDK never sends a requirement it was not given and never weakens one.
The neutral names of the SDK specification, as TypeScript and JavaScript writes them. The full reference is generated from the SDK's own doc comments when it is released.
| Method | Sends and returns |
|---|---|
client.tasks.run | POST /v1/tasks, synchronous: the task's typed output, usage and meta |
client.jobs.create | POST /v1/jobs, asynchronous: the job with its id and state |
client.jobs.get | GET /v1/jobs/{id}: the job, with the result when completed |
client.jobs.wait | jobs.get repeated, honoring the server's interval, until completed, failed, canceled or interrupted |
client.jobs.cancel | The cancel route: the job |
client.uploads.upload | POST /v1/uploads then the PUT: a task input, never model weights |
client.models.list | GET /v1/models: a page of models |
client.deployments.get | The read side of a deployment, with its state |
client.tasks.runRaw | The body exactly as given: a field this SDK version does not know yet |
- Method
client.tasks.run- Sends and returns
POST /v1/tasks, synchronous: the task's typed output,usageandmeta
- Method
client.jobs.create- Sends and returns
POST /v1/jobs, asynchronous: the job with its id and state
- Method
client.jobs.get- Sends and returns
GET /v1/jobs/{id}: the job, with the result whencompleted
- Method
client.jobs.wait- Sends and returns
jobs.getrepeated, honoring the server's interval, untilcompleted,failed,canceledorinterrupted
- Method
client.jobs.cancel- Sends and returns
- The cancel route: the job
- Method
client.uploads.upload- Sends and returns
POST /v1/uploadsthen thePUT: a task input, never model weights
- Method
client.models.list- Sends and returns
GET /v1/models: a page of models
- Method
client.deployments.get- Sends and returns
- The read side of a deployment, with its state
- Method
client.tasks.runRaw- Sends and returns
- The body exactly as given: a field this SDK version does not know yet
Related sheets
- Sheet
- 04 of 13
- Detail
- B
- Updated
- 2026-10-21
- Status
- Preview