SpyBara
Go Premium

quickstart.md 2026-04-07 05:51 UTC to 2026-04-08 05:51 UTC

1 added, 1 removed.

2026
Thu 30 06:13 Tue 28 06:15 Sat 25 05:52 Fri 24 05:58 Thu 23 05:56 Wed 22 05:55 Thu 16 05:55 Wed 15 05:55 Tue 14 05:55 Sat 11 05:41 Thu 9 05:52 Wed 8 05:51 Tue 7 05:51 Wed 1 05:53

Developer quickstart

import { Assistant, Camera, ChatTripleDots, Code, Bolt, Speed, SquarePlus, } from "@components/react/oai/platform/ui/Icon.react";

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.
Access dashboard features 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. StatsigClient.logEvent( "quickstart_add_credits_agent_builder_click", null, null ) } > Build, deploy, and optimize agent workflows.

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)