{"id":51280279,"url":"https://github.com/momentic-ai/js","last_synced_at":"2026-06-30T01:03:25.867Z","repository":{"id":254175552,"uuid":"736821444","full_name":"momentic-ai/js","owner":"momentic-ai","description":"Momentic JavaScript SDK","archived":false,"fork":false,"pushed_at":"2024-11-20T19:45:40.000Z","size":20510,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T12:26:19.800Z","etag":null,"topics":["ai","api","npm","openapi","sdk","testing"],"latest_commit_sha":null,"homepage":"https://docs.momentic.ai","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/momentic-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-29T01:29:36.000Z","updated_at":"2025-07-06T21:29:50.000Z","dependencies_parsed_at":"2024-08-21T22:13:54.238Z","dependency_job_id":"b3df1a93-b6b0-4f24-821e-8d264590c59b","html_url":"https://github.com/momentic-ai/js","commit_stats":null,"previous_names":["momentic-ai/sdk","momentic-ai/js","momentic-ai/momentic"],"tags_count":112,"template":false,"template_full_name":null,"purl":"pkg:github/momentic-ai/js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momentic-ai%2Fjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momentic-ai%2Fjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momentic-ai%2Fjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momentic-ai%2Fjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/momentic-ai","download_url":"https://codeload.github.com/momentic-ai/js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momentic-ai%2Fjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34948228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","npm","openapi","sdk","testing"],"created_at":"2026-06-30T01:03:25.168Z","updated_at":"2026-06-30T01:03:25.849Z","avatar_url":"https://github.com/momentic-ai.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# @momentic/js\n\nDeveloper-friendly \u0026 type-safe Typescript SDK specifically catered to leverage *@momentic/js* API.\n\n\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://www.speakeasy.com/?utm_source=@momentic/js\u0026utm_campaign=typescript\"\u003e\u003cimg src=\"https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge\u0026logoColor=FBE331\u0026logo=speakeasy\u0026labelColor=545454\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" style=\"width: 100px; height: 28px;\" /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\u003c!-- Start Summary [summary] --\u003e\n## Summary\n\nMomentic API: The Momentic REST API. Please see https://docs.momentic.ai for more details.\n\u003c!-- End Summary [summary] --\u003e\n\n\u003c!-- Start Table of Contents [toc] --\u003e\n## Table of Contents\n\n* [SDK Installation](#sdk-installation)\n* [Requirements](#requirements)\n* [SDK Example Usage](#sdk-example-usage)\n* [Available Resources and Operations](#available-resources-and-operations)\n* [Standalone functions](#standalone-functions)\n* [Retries](#retries)\n* [Error Handling](#error-handling)\n* [Server Selection](#server-selection)\n* [Custom HTTP Client](#custom-http-client)\n* [Authentication](#authentication)\n* [Debugging](#debugging)\n\u003c!-- End Table of Contents [toc] --\u003e\n\n\u003c!-- Start SDK Installation [installation] --\u003e\n## SDK Installation\n\nThe SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.\n\n### NPM\n\n```bash\nnpm add \u003cUNSET\u003e\n```\n\n### PNPM\n\n```bash\npnpm add \u003cUNSET\u003e\n```\n\n### Bun\n\n```bash\nbun add \u003cUNSET\u003e\n```\n\n### Yarn\n\n```bash\nyarn add \u003cUNSET\u003e zod\n\n# Note that Yarn does not install peer dependencies automatically. You will need\n# to install zod as shown above.\n```\n\n\u003e [!NOTE]\n\u003e This package is published with CommonJS and ES Modules (ESM) support.\n\u003c!-- End SDK Installation [installation] --\u003e\n\n\u003c!-- Start Requirements [requirements] --\u003e\n## Requirements\n\nFor supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).\n\u003c!-- End Requirements [requirements] --\u003e\n\n\u003c!-- Start SDK Example Usage [usage] --\u003e\n## SDK Example Usage\n\n### Example\n\n```typescript\nimport { Momentic } from \"@momentic/js\";\n\nconst momentic = new Momentic({\n  apiKey: process.env[\"MOMENTIC_API_KEY\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await momentic.runs.getStatuses();\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n\u003c!-- End SDK Example Usage [usage] --\u003e\n\n\u003c!-- Start Available Resources and Operations [operations] --\u003e\n## Available Resources and Operations\n\n\u003cdetails open\u003e\n\u003csummary\u003eAvailable methods\u003c/summary\u003e\n\n\n### [runs](docs/sdks/runs/README.md)\n\n* [getStatuses](docs/sdks/runs/README.md#getstatuses) - Get run statuses\n* [get](docs/sdks/runs/README.md#get) - Get run statuses\n\n### [steps](docs/sdks/steps/README.md)\n\n* [queue](docs/sdks/steps/README.md#queue) - Queue steps run\n\n\u003c/details\u003e\n\u003c!-- End Available Resources and Operations [operations] --\u003e\n\n\u003c!-- Start Standalone functions [standalone-funcs] --\u003e\n## Standalone functions\n\nAll the methods listed above are available as standalone functions. These\nfunctions are ideal for use in applications running in the browser, serverless\nruntimes or other environments where application bundle size is a primary\nconcern. When using a bundler to build your application, all unused\nfunctionality will be either excluded from the final bundle or tree-shaken away.\n\nTo read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAvailable standalone functions\u003c/summary\u003e\n\n- [`runsGet`](docs/sdks/runs/README.md#get) - Get run statuses\n- [`runsGetStatuses`](docs/sdks/runs/README.md#getstatuses) - Get run statuses\n- [`stepsQueue`](docs/sdks/steps/README.md#queue) - Queue steps run\n\n\u003c/details\u003e\n\u003c!-- End Standalone functions [standalone-funcs] --\u003e\n\n\u003c!-- Start Retries [retries] --\u003e\n## Retries\n\nSome of the endpoints in this SDK support retries.  If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API.  However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.\n\nTo change the default retry strategy for a single API call, simply provide a retryConfig object to the call:\n```typescript\nimport { Momentic } from \"@momentic/js\";\n\nconst momentic = new Momentic({\n  apiKey: process.env[\"MOMENTIC_API_KEY\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await momentic.runs.getStatuses({\n    retries: {\n      strategy: \"backoff\",\n      backoff: {\n        initialInterval: 1,\n        maxInterval: 50,\n        exponent: 1.1,\n        maxElapsedTime: 100,\n      },\n      retryConnectionErrors: false,\n    },\n  });\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n\nIf you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:\n```typescript\nimport { Momentic } from \"@momentic/js\";\n\nconst momentic = new Momentic({\n  retryConfig: {\n    strategy: \"backoff\",\n    backoff: {\n      initialInterval: 1,\n      maxInterval: 50,\n      exponent: 1.1,\n      maxElapsedTime: 100,\n    },\n    retryConnectionErrors: false,\n  },\n  apiKey: process.env[\"MOMENTIC_API_KEY\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await momentic.runs.getStatuses();\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n\u003c!-- End Retries [retries] --\u003e\n\n\u003c!-- Start Error Handling [errors] --\u003e\n## Error Handling\n\nAll SDK methods return a response object or throw an error. By default, an API error will throw a `errors.SDKError`.\n\nIf a HTTP request fails, an operation my also throw an error from the `models/errors/httpclienterrors.ts` module:\n\n| HTTP Client Error                                    | Description                                          |\n| ---------------------------------------------------- | ---------------------------------------------------- |\n| RequestAbortedError                                  | HTTP request was aborted by the client               |\n| RequestTimeoutError                                  | HTTP request timed out due to an AbortSignal signal  |\n| ConnectionError                                      | HTTP client was unable to make a request to a server |\n| InvalidRequestError                                  | Any input used to create a request is invalid        |\n| UnexpectedClientError                                | Unrecognised or unexpected error                     |\n\nIn addition, when custom error responses are specified for an operation, the SDK may throw their associated Error type. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. For example, the `getStatuses` method may throw the following errors:\n\n| Error Type      | Status Code | Content Type |\n| --------------- | ----------- | ------------ |\n| errors.SDKError | 4XX, 5XX    | \\*/\\*        |\n\n```typescript\nimport { Momentic } from \"@momentic/js\";\nimport { SDKValidationError } from \"@momentic/js/models/errors\";\n\nconst momentic = new Momentic({\n  apiKey: process.env[\"MOMENTIC_API_KEY\"] ?? \"\",\n});\n\nasync function run() {\n  let result;\n  try {\n    result = await momentic.runs.getStatuses();\n\n    // Handle the result\n    console.log(result);\n  } catch (err) {\n    switch (true) {\n      case (err instanceof SDKValidationError): {\n        // Validation errors can be pretty-printed\n        console.error(err.pretty());\n        // Raw value may also be inspected\n        console.error(err.rawValue);\n        return;\n      }\n      default: {\n        throw err;\n      }\n    }\n  }\n}\n\nrun();\n\n```\n\nValidation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted string since validation errors can list many issues and the plain error string may be difficult read when debugging.\n\u003c!-- End Error Handling [errors] --\u003e\n\n\u003c!-- Start Server Selection [server] --\u003e\n## Server Selection\n\n### Select Server by Index\n\nYou can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:\n\n| #   | Server                            |\n| --- | --------------------------------- |\n| 0   | `https://api.momentic.ai`         |\n| 1   | `https://api.staging.momentic.ai` |\n\n#### Example\n\n```typescript\nimport { Momentic } from \"@momentic/js\";\n\nconst momentic = new Momentic({\n  serverIdx: 1,\n  apiKey: process.env[\"MOMENTIC_API_KEY\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await momentic.runs.getStatuses();\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n\n### Override Server URL Per-Client\n\nThe default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:\n```typescript\nimport { Momentic } from \"@momentic/js\";\n\nconst momentic = new Momentic({\n  serverURL: \"https://api.momentic.ai\",\n  apiKey: process.env[\"MOMENTIC_API_KEY\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await momentic.runs.getStatuses();\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n\u003c!-- End Server Selection [server] --\u003e\n\n\u003c!-- Start Custom HTTP Client [http-client] --\u003e\n## Custom HTTP Client\n\nThe TypeScript SDK makes API calls using an `HTTPClient` that wraps the native\n[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This\nclient is a thin wrapper around `fetch` and provides the ability to attach hooks\naround the request lifecycle that can be used to modify the request or handle\nerrors and response.\n\nThe `HTTPClient` constructor takes an optional `fetcher` argument that can be\nused to integrate a third-party HTTP client or when writing tests to mock out\nthe HTTP client and feed in fixtures.\n\nThe following example shows how to use the `\"beforeRequest\"` hook to to add a\ncustom header and a timeout to requests and how to use the `\"requestError\"` hook\nto log errors:\n\n```typescript\nimport { Momentic } from \"@momentic/js\";\nimport { HTTPClient } from \"@momentic/js/lib/http\";\n\nconst httpClient = new HTTPClient({\n  // fetcher takes a function that has the same signature as native `fetch`.\n  fetcher: (request) =\u003e {\n    return fetch(request);\n  }\n});\n\nhttpClient.addHook(\"beforeRequest\", (request) =\u003e {\n  const nextRequest = new Request(request, {\n    signal: request.signal || AbortSignal.timeout(5000)\n  });\n\n  nextRequest.headers.set(\"x-custom-header\", \"custom value\");\n\n  return nextRequest;\n});\n\nhttpClient.addHook(\"requestError\", (error, request) =\u003e {\n  console.group(\"Request Error\");\n  console.log(\"Reason:\", `${error}`);\n  console.log(\"Endpoint:\", `${request.method} ${request.url}`);\n  console.groupEnd();\n});\n\nconst sdk = new Momentic({ httpClient });\n```\n\u003c!-- End Custom HTTP Client [http-client] --\u003e\n\n\u003c!-- Start Authentication [security] --\u003e\n## Authentication\n\n### Per-Client Security Schemes\n\nThis SDK supports the following security scheme globally:\n\n| Name     | Type | Scheme      | Environment Variable |\n| -------- | ---- | ----------- | -------------------- |\n| `apiKey` | http | HTTP Bearer | `MOMENTIC_API_KEY`   |\n\nTo authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:\n```typescript\nimport { Momentic } from \"@momentic/js\";\n\nconst momentic = new Momentic({\n  apiKey: process.env[\"MOMENTIC_API_KEY\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await momentic.runs.getStatuses();\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n\u003c!-- End Authentication [security] --\u003e\n\n\u003c!-- Start Debugging [debug] --\u003e\n## Debugging\n\nYou can setup your SDK to emit debug logs for SDK requests and responses.\n\nYou can pass a logger that matches `console`'s interface as an SDK option.\n\n\u003e [!WARNING]\n\u003e Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.\n\n```typescript\nimport { Momentic } from \"@momentic/js\";\n\nconst sdk = new Momentic({ debugLogger: console });\n```\n\nYou can also enable a default debug logger by setting an environment variable `MOMENTIC_DEBUG` to true.\n\u003c!-- End Debugging [debug] --\u003e\n\n\u003c!-- Placeholder for Future Speakeasy SDK Sections --\u003e\n\n# Development\n\n## Maturity\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage\nto a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally\nlooking for the latest version.\n\n## Contributions\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. \nWe look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. \n\n### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@momentic/js\u0026utm_campaign=typescript)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomentic-ai%2Fjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomentic-ai%2Fjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomentic-ai%2Fjs/lists"}