Passing the API Key when using Assistants

In the current Assistants docs, there’s no mention of how to use the API key. In case you’re wondering, here’s how to do it in NodeJS:

  1. Put the key into a .env file like this:

OPENAI_API_KEY=<key goes here>

  1. Pass it as an argument to the OpenAI constructor:
require('dotenv').config();
const OpenAI = require('openai');
const openai = new OpenAI({ apiKey: `${process.env.OPENAI_API_KEY}`});