Quickstart

The easiest way to get started is with our OpenAI wrappers! We've wrapped OpenAI's SDKs with ours to make getting literally just changing an import statement. All your OpenAI code can be left untouched!

Get API key

Sign up for an account and get your API key at https://accounts.usespryngtime.com/sign-in

Set your OpenAI and Spryngtime API keys in your environment/.env file

For example:

OPENAI_API_KEY=sk-openaiapikey
SPRYNGTIME_API_KEY=spryngtime_api_key

Install package

If Python, install our Python package

# if using regular OpenAI
pip install spryngtime-openai-python

# if using Azure
pip install spryngtime-azure-openai-python

If Node.js, install our Node.js package

// if using regular OpenAI
npm install spryngtime-openai-node

// if using Azure
npm install spryngtime-azure-openai-node

Track with one line of code!

Track with one line of code using one of our OpenAI wrapper helpers!

Javascript/Typescript:

// Replace
const {OpenAI} = require('openai')

// with if using OpenAI
const OpenAI = require("spryngtime-openai-node").SpryngtimeOpenAI

// with if using Azure OpenAI
const OpenAIClient = require("spryngtime-azure-openai-node").SpryngtimeOpenAI;

Python:

# Replace
from openai import OpenAI

# with if using OpenAI
from SpryngtimeOpenAI.SpryngtimeOpenAI import SpryngtimeOpenAI as OpenAI

# with if using Azure OpenAI
import SpryngtimeOpenAI as openai

Adding a user field to your OpenAI request helps you both track/rate limit in OpenAI and in Spryngtime! When you add a user field, we associate all responses/usage to that user.

This is helpful if you want to track usage for billing or analytics purposes for customers.

Here's an example in node:

const chatCompletion = await openai.chat.completions.create({
    messages: [{ role: 'user', content: query }],
    model: 'gpt-3.5-turbo-1106',
    max_tokens: 100,
    user:"user_123456", // Set this to the customer/user you want the query to be tracked to
});

That's it!

Login to the dashboard

Last updated