Developer quickstart
The OpenAI API provides a simple interface to state-of-the-art AI models for text generation, natural language processing, computer vision, and more. Get started by creating an API Key and running your first API call. Discover how to generate text, analyze images, build agents, and more.
Create and export an API key
StatsigClient.logEvent("quickstart_create_api_key_click", null, null) }
Create an API Key
Before you begin, create an API key in the dashboard, which you'll use to securely [access the API](https://developers.openai.com/api/docs/api-reference/authentication). Store the key in a safe location, like a [`.zshrc` file](https://www.freecodecamp.org/news/how-do-zsh-configuration-files-work/) or another text file on your computer. Once you've generated an API key, export it as an [environment variable](https://en.wikipedia.org/wiki/Environment_variable) in your terminal.export OPENAI_API_KEY="your_api_key_here"
setx OPENAI_API_KEY "your_api_key_here"
OpenAI SDKs are configured to automatically read your API key from the system environment.
Install the OpenAI SDK and Run an API Call
<a href="https://github.com/openai/openai-responses-starter-app" target="_blank" rel="noreferrer"
Start building with the Responses API.
[
Learn more about prompting, message roles, and building conversational apps.](https://developers.openai.com/api/docs/guides/text)
Add credits to keep building
StatsigClient.logEvent("quickstart_add_credits_billing_click", null, null) }
Go to billing
{/* prettier-ignore */}
](https://developers.openai.com/api/docs/guides/agents)
Analyze images and files
Send image URLs, uploaded files, or PDF documents directly to the model to extract text, classify content, or detect visual elements.
[
Learn to use image inputs to the model and extract meaning from images.](https://developers.openai.com/api/docs/guides/images)
[
Learn to use file inputs to the model and extract meaning from documents.](https://developers.openai.com/api/docs/guides/file-inputs)
Extend the model with tools
Give the model access to external data and functions by attaching tools. Use built-in tools like web search or file search, or define your own for calling APIs, running code, or integrating with third-party systems.
[
Learn about powerful built-in tools like web search and file search.](https://developers.openai.com/api/docs/guides/tools)
[
Learn to enable the model to call your own custom code.](https://developers.openai.com/api/docs/guides/function-calling)
Stream responses and build realtime apps
Use server‑sent streaming events to show results as they’re generated, or the Realtime API for interactive voice and multimodal apps.
[
Use server-sent events to stream model responses to users fast.](https://developers.openai.com/api/docs/guides/streaming-responses)
[
Use WebRTC or WebSockets for super fast speech-to-speech AI apps.](https://developers.openai.com/api/docs/guides/realtime)
Build agents
Use the OpenAI platform to build agents capable of taking action—like controlling computers—on behalf of your users. Use the Agents SDK to create orchestration logic on the backend.
[
Learn how to use the OpenAI platform to build powerful, capable AI agents.