@speakeasy-sdks/jasper-ai
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

Jasper Typescript SDK

AI content generator for teams

SDK Installation

NPM

npm add @speakeasy-sdks/jasper-ai

Yarn

yarn add @speakeasy-sdks/jasper-ai

Authentication

In order to use Jasper's API, you will need to authenticate every request. We rely on API tokens to authenticate API requests.

Tokens are scoped to an admin's permission set and workspace.

Admins can generate API tokens in their workspace via Settings/API tokens

Once your API token is generated, you will need to pass it in an 'x-api-key' Authorization header.

curl 
  --location --request GET 'https://api.jasper.ai/v1/$endpoint' \
  --header 'x-api-key: $YOUR_API_KEY' \

SDK Example Usage

import { Jasper } from "@speakeasy-sdks/jasper-ai";
import { RunCommandResponse } from "@speakeasy-sdks/jasper-ai/dist/sdk/models/operations";

const sdk = new Jasper({
  security: {
    apiKeyAuth: "YOUR_API_KEY_HERE",
  },
});

sdk.commands.run({
  inputs: {
    command: "Write a haiku about rabbits",
    context: "All rabbits eat kale",
  },
  options: {
    inputLanguage: "corrupti",
    languageFormality: "provident",
    outputCount: 715190,
    outputLanguage: "quibusdam",
  },
}).then((res: RunCommandResponse) => {
  if (res.statusCode == 200) {
    // handle response
  }
});

Available Resources and Operations

commands

  • run - Run a command to generate an AI Output

templates

  • get - Retrieve an individual default or custom template available in your workspace by ID
  • list - Get a list of available templates
  • run - Run a default template or custom template by ID to generate an AI output. See our guide on Using Templates for tips on getting started.

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !

SDK Created by Speakeasy

Readme

Keywords

none

Package Sidebar

Install

npm i @speakeasy-sdks/jasper-ai

Weekly Downloads

2

Version

1.5.0

License

none

Unpacked Size

150 kB

Total Files

65

Last publish

Collaborators

  • ccrumbaugh
  • ghaidar-speakeasy
  • ndimares
  • thomasrooneyspeakeasy
  • speakeasysimon
  • tristanspeakeasy
  • simplesagar