BaşlayınÜcretsiz Başlayın

Your First Responses API Call

Time to get hands-on with OpenAI's Responses API! You'll be using the openai library to begin making requests to the Responses API endpoint.

The OpenAI class has already been imported from openai.

Bu egzersiz

Working with the OpenAI Responses API

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Define an OpenAI API client, leaving the api_key placeholder unchanged.
  • Create an OpenAI API request to the "gpt-5-mini" model, sending the prompt "In simple terms, what is the OpenAI Responses API?"; leave the reasoning and max_output_tokens parameter unchanged.
  • Print the generated text from the response object.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Define an OpenAI API client
client = ____(api_key="")

# Create the OpenAI API request
response = client.____.____(
    ____="gpt-5-mini",
    input="____",
    reasoning={"effort": "minimal"},
    max_output_tokens=100
)

# Print the generated text from the response
print(response.____)
Kodu Düzenle ve Çalıştır