SpyBara
Go Premium

quickstart.md 2026-06-10 15:48 UTC to 2026-06-11 08:59 UTC

0 added, 28 removed.

2026
Wed 24 22:02 Tue 23 15:59 Mon 22 22:58 Tue 16 21:57 Mon 15 23:02 Fri 12 19:02 Thu 11 08:59 Wed 10 15:48 Tue 9 06:34 Fri 5 06:45 Thu 4 06:52 Wed 3 06:53 Tue 2 06:51 Mon 1 06:53

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 an environment variable on macOS or Linux systems
export 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 */}

Congrats on running a free test API request! Start building real applications with higher limits and use our models to generate text, audio, images, videos and more.
Explore tools and docs designed to help you ship faster:
StatsigClient.logEvent( "quickstart_add_credits_chat_playground_click", null, null ) } > Build & test conversational prompts and embed them in your app. [ Use the Agents SDK to build, run, and observe agent workflows.

](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.

](https://developers.openai.com/api/docs/guides/agents)