Programmatic access to OpenAI’s models enables seamless integration of GPT-powered features into your applications. In this guide, we’ll cover how to install and use the official OpenAI SDKs for Python and Node.js, leverage the OpenAI CLI for quick API operations, and explore community-maintained libraries.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Official SDKs
For the latest SDKs, visit the OpenAI documentation under “Libraries”. Below is a quick overview:| Language | Package | Install Command | Documentation |
|---|---|---|---|
| Python | openai | pip install openai | Python SDK Guide |
| Node.js | openai | npm install openai | Node.js SDK Guide |
Python SDK
Installation
- The Python client library (
import openai) - The
openaiCLI tool for tasks like generating completions or fine-tuning models
Never commit your
OPENAI_API_KEY in plaintext. Always load it from an environment variable or a secrets manager.Quickstart Example
Using the CLI
The
openai CLI supports commands for completions, embeddings, file uploads, and fine-tuning. Run openai --help to explore all options.Node.js SDK
Installation
Basic Usage (JavaScript)
Community Libraries
OpenAI’s documentation also links to community-maintained libraries across various languages. Use these with caution, as they are not officially supported: