#Can I get you

1 messages · Page 1 of 1 (latest)

long basinBOT
#

Hi @austere kiln. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I'd be happy to help you with code examples for OpenAI! Based on the knowledge sources, here are some code examples for getting started with the OpenAI API:

Basic API Request

Here's a simple example using the Responses API:

Python:

from openai import OpenAI
client = OpenAI()

response = client.responses.create(
    model="gpt-5",
    input="Write a one-sentence bedtime story about a unicorn."
)

print(response.output_text)

JavaScript:

import OpenAI from "openai";
const client = new OpenAI();

const response = await client.responses.create({
    model: "gpt-5",
    input: "Write a one-sentence bedtime story about a unicorn."
});

console.log(response.output_text);

Installation

First, install the OpenAI SDK:

  • Python: pip install openai
  • JavaScript: npm install openai

You can find more examples and detailed guides in the OpenAI documentation, including examples for reasoning models, Code Interpreter, and Assistants API.

Is there a specific use case or feature you'd like code examples for?

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@austere kiln Kapa.ai is still learning and improving, please let me know how I did by reacting below.