Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
SDKs and CLI | OpenAI API
[go: Go Back, main page]

Primary navigation

Evaluation

SDKs and CLI

Choose the right way to build with the OpenAI API: an SDK for applications, the CLI for terminal workflows, or the Agents SDK for orchestration.

This page covers the main ways to build with the OpenAI API: official SDKs for application code, the OpenAI CLI for shell-native workflows, the Agents SDK for orchestration, or your own preferred HTTP client.

Create and export an API key

Before you begin, create an API key in the dashboard, which you’ll use to securely access the API. Store the key in a safe location, like a .zshrc file or another text file on your computer. Once you’ve generated an API key, export it as an environment variable in your terminal.

Export an environment variable on macOS or Linux systems
1
export OPENAI_API_KEY="your_api_key_here"