Overview
This article summarizes how to use the OpenAI Response API for text generation. It covers the official documentation, how to obtain an API key, and a minimal Python example.
What is the Response API?
The Response API is OpenAI’s unified API for text generation, tool calls, and multi-turn interactions. It works for both one-off requests and conversational workflows.
Official documentation
The most reliable source for the latest specs is the official documentation.
- Response API reference: https://platform.openai.com/docs/api-reference/responses
How to get an API key
You need an OpenAI API key to use the Response API. Follow these steps:
- Sign in to the OpenAI dashboard
- Open the API Keys page: https://platform.openai.com/api-keys
- Create a new key with “Create new secret key”
Store the key in an environment variable for safety.
|
|
Python sample code
Install the Python SDK with uv:
|
|
Below is a minimal sample that calls the Response API.
|
|
Example output
|
|
Summary
The Response API is a straightforward way to generate text with OpenAI. Check the docs, prepare an API key, and try the Python SDK for a smooth start.