12/5/26, 7:40 p.m.
Prompt engineering | OpenAI API
Responses
Prompt engineering
Enhance results with prompt engineering strategies.
Copy Page
With the OpenAI API, you can use a large language model to generate text from a
prompt, as you might using ChatGPT. Models can generate almost any kind of text
response—like code, mathematical equations, structured JSON data, or human-like
prose.
Here’s a simple example using the Responses API.
Generate text from a simple prompt javascript
1 import OpenAI from "openai";
2 const client = new OpenAI();
3
4 const response = await [Link]({
5 model: "gpt-5.5",
6 input: "Write a one-sentence bedtime story about a unicorn."
7 });
8
9 [Link](response.output_text);
An array of content generated by the model is in the output property of the response. In
this simple example, we have just one output which looks like this:
1 [
2 {
3 "id": "msg_67b73f697ba4819183a15cc17d011509",
4 "type": "message",
5 "role": "assistant",
[Link] 1/1