This guide will get you all set up and ready to use the Basalt API. We’ll cover how to get started using our Python and JavaScript/TypeScript SDKs and how to make your first request. We’ll also look at where to go next to find all the information you need to take full advantage of our SDKs.

Prerequisites: Before you begin, make sure to have an account on Basalt.

Getting Started

1

Install the SDK

First, install the SDK for your language.

npm install @basalt-ai/sdk
2

Instantiate Basalt

Instantiate the SDK with your API key. If you don’t have one, you can get it from the Basalt Dashboard.

import { Basalt } from '@basalt-ai/sdk';

const basalt = new Basalt({ apiKey: 'your-api-key' });
3

Get your prompt

Get your first prompt using the basalt.prompt.get method with the slugof your prompt as parameter.

Only deployed prompts can be retrieve with this method. To know how to deploy your prompt and get your slug, follow our guide.
const { value } = await basalt.prompt.get('my-prompt-slug')

Learn more about how to get your prompt and discover all the available options in the Prompts documentation.

4

Monitor the output

After getting your prompt, you can easily monitor the output of your LLM, pushing it back to Basalt.

const { value, generation } = await basalt.prompt.get('my-prompt-slug')

const output = await myLLMFunction(value.text) // call your own LLM function with the retrieved prompt and get the output

generation.end(output)

Learn more about how to monitor your prompt, discover all the available options and more advanced use cases in the Monitoring documentation.

Next Steps