OpenAI kündigt wiederverwendbare Prompt-Objekte in der API ab. Die Erstellung von Prompts wird
ab dem 3. Juni 2026 weniger in den Vordergrund gerückt. Die Abschaltung von v1/prompts ist
für den 30. November 2026 geplant. Den aktuellen Zeitplan findest du auf der Seite zu
Abkündigungen.
Um von Prompts auf der OpenAI API-Plattform wegzumigrieren, übertrage den Prompt-Inhalt aus dem verwalteten prompt-Objekt in deinen Anwendungscode. So hast du mehr Kontrolle über Review, Tests, Deployment und Versionierung.
1
2
3
4
5
6
7
8
9
10
11
12
13
14import OpenAI from "openai";
const client = new OpenAI();
const response = await client.responses.create({
prompt: {
id: "pmpt_123",
version: "1",
variables: {
customer_name: "Acme",
issue: "billing question",
},
},
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17# Replace the illustrative IDs and URLs below with your own resource values.
from openai import OpenAI
client = OpenAI()
prompt_id = "pmpt_123"
response = client.responses.create(
prompt={
"prompt_id": prompt_id,
"version": "1",
"variables": {
"customer_name": "Acme",
"issue": "billing question",
},
}
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27package main
import (
"context"
"fmt"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Prompt: responses.ResponsePromptParam{
ID: "pmpt_123",
Version: openai.String("1"),
Variables: map[string]responses.ResponsePromptVariableUnionParam{
"customer_name": {OfString: openai.String("Acme")},
"issue": {OfString: openai.String("billing question")},
},
},
})
if err != nil {
panic(err)
}
fmt.Println(response.OutputText())
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.core.JsonValue;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.models.responses.ResponsePrompt;
String promptId = "pmpt_123";
ResponseCreateParams params =
ResponseCreateParams.builder()
.prompt(
ResponsePrompt.builder()
.id(promptId)
.version("1")
.variables(
ResponsePrompt.Variables.builder()
.putAdditionalProperty("customer_name", JsonValue.from("Acme"))
.putAdditionalProperty("issue", JsonValue.from("billing question"))
.build())
.build())
.build();
client.responses().create(params).output().stream()
.flatMap(item -> item.message().stream())
.flatMap(message -> message.content().stream())
.flatMap(content -> content.outputText().stream())
.forEach(text -> System.out.println(text.text()));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16require "openai"
client = OpenAI::Client.new
response = client.responses.create(
prompt: {
id: "pmpt_123",
version: "1",
variables: {
customer_name: "Acme",
issue: "billing question"
}
}
)
puts(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"prompt": {
"prompt_id": "pmpt_123",
"version": "1",
"variables": {
"customer_name": "Acme",
"issue": "billing question"
}
}
}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21import OpenAI from "openai";
const client = new OpenAI();
const response = await client.responses.create({
model: "gpt-6-astra",
input: [
{
role: "system",
content:
"You are a helpful support assistant. Be concise, accurate, and friendly.",
},
{
role: "user",
content:
"Customer name: Acme. Issue: billing question. Write a response to the customer.",
},
],
});
console.log(response.output_text);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-6-astra",
input=[
{
"role": "system",
"content": "You are a helpful support assistant. Be concise, accurate, and friendly.",
},
{
"role": "user",
"content": "Customer name: Acme. Issue: billing question. Write a response to the customer.",
},
],
)
print(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24package main
import (
"context"
"fmt"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6-astra",
Input: responses.ResponseNewParamsInputUnion{OfInputItemList: responses.ResponseInputParam{
responses.ResponseInputItemParamOfMessage("You are a helpful support assistant. Be concise, accurate, and friendly.", responses.EasyInputMessageRoleSystem),
responses.ResponseInputItemParamOfMessage("Customer name: Acme. Issue: billing question. Write a response to the customer.", responses.EasyInputMessageRoleUser),
}},
})
if err != nil {
panic(err)
}
fmt.Println(response.OutputText())
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.EasyInputMessage;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.models.responses.ResponseInputItem;
import java.util.List;
ResponseCreateParams params =
ResponseCreateParams.builder()
.model("gpt-6-astra")
.inputOfResponse(
List.of(
ResponseInputItem.ofEasyInputMessage(
EasyInputMessage.builder()
.role(EasyInputMessage.Role.SYSTEM)
.content(
"You are a helpful support assistant. Be concise, accurate, and friendly.")
.build()),
ResponseInputItem.ofEasyInputMessage(
EasyInputMessage.builder()
.role(EasyInputMessage.Role.USER)
.content(
"Customer name: Acme. Issue: billing question. Write a response to the customer.")
.build())))
.build();
client.responses().create(params).output().stream()
.flatMap(item -> item.message().stream())
.flatMap(message -> message.content().stream())
.flatMap(content -> content.outputText().stream())
.forEach(text -> System.out.println(text.text()));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19using OpenAI.Responses;
#pragma warning disable OPENAI001
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
ResponsesClient client = new(key);
ResponseResult response = await client.CreateResponseAsync(
"gpt-6-astra",
[
ResponseItem.CreateSystemMessageItem(
"You are a helpful support assistant. Be concise, accurate, and friendly."
),
ResponseItem.CreateUserMessageItem(
"Customer name: Acme. Issue: billing question. Write a response to the customer."
),
]
);
Console.WriteLine(response.GetOutputText());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19require "openai"
client = OpenAI::Client.new
response = client.responses.create(
model: "gpt-6-astra",
input: [
{
role: :system,
content: "You are a helpful support assistant. Be concise, accurate, and friendly."
},
{
role: :user,
content: "Customer name: Acme. Issue: billing question. Write a response to the customer."
}
]
)
puts(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-6-astra",
"input": [
{
"role": "system",
"content": "You are a helpful support assistant. Be concise, accurate, and friendly."
},
{
"role": "user",
"content": "Customer name: Acme. Issue: billing question. Write a response to the customer."
}
]
}'
Nutze das OpenAI Developers-Plug-in und den OpenAI Docs-Skill, um deine Migration zu automatisieren und schneller mit der OpenAI API zu entwickeln.
$openai-docs update this project to store prompts in code instead of using a prompts object
Statt in einer API-Anfrage auf ein gespeichertes Prompt-Objekt zu verweisen, speicherst du den Prompt-Text in deiner Codebasis und übergibst die erzeugten Nachrichten direkt als input im Aufruf der Responses API.
- Verlagere Prompt-Inhalte in den Quellcode , damit Änderungen an Prompts denselben Review- und Release-Prozess durchlaufen wie die Produktlogik.
- Ersetze Prompt-Variablen durch Funktionsargumente , damit dynamische Werte in deiner Anwendung explizit angegeben und typisiert sind.
- Übergib Nachrichten über
input im Aufruf der Responses API, statt das prompt-Objekt zu verwenden.
- Verlagere die Versionierung in dein Repository und nutze dafür Git-Commits, PR-Reviews sowie Tests oder Evaluationen.
- Platziere statische Inhalte zuerst und dynamische Inhalte danach , um die Vorteile des Prompt-Cachings zu erhalten. Cache-Treffer setzen voraus, dass die Präfixe exakt übereinstimmen.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25import OpenAI from "openai";
const client = new OpenAI();
function buildSupportPrompt({ customerName, issue }) {
return [
{
role: "system",
content:
"You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details.",
},
{
role: "user",
content: `Customer name: ${customerName}. Issue: ${issue}. Write a response to the customer.`,
},
];
}
const response = await client.responses.create({
model: "gpt-6-astra",
input: buildSupportPrompt({
customerName: "Acme",
issue: "billing question",
}),
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25from openai import OpenAI
client = OpenAI()
def build_support_prompt(customer_name, issue):
return [
{
"role": "system",
"content": "You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details.",
},
{
"role": "user",
"content": f"Customer name: {customer_name}. Issue: {issue}. Write a response to the customer.",
},
]
response = client.responses.create(
model="gpt-6-astra",
input=build_support_prompt(
customer_name="Acme",
issue="billing question",
),
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28package main
import (
"context"
"fmt"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6-astra",
Input: responses.ResponseNewParamsInputUnion{OfInputItemList: buildSupportPrompt("Acme", "billing question")},
})
if err != nil {
panic(err)
}
fmt.Println(response.OutputText())
}
func buildSupportPrompt(customerName string, issue string) responses.ResponseInputParam {
return responses.ResponseInputParam{
responses.ResponseInputItemParamOfMessage("You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details.", responses.EasyInputMessageRoleSystem),
responses.ResponseInputItemParamOfMessage(fmt.Sprintf("Customer name: %s. Issue: %s. Write a response to the customer.", customerName, issue), responses.EasyInputMessageRoleUser),
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.EasyInputMessage;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.models.responses.ResponseInputItem;
import java.util.List;
private static List<ResponseInputItem> buildSupportPrompt(String customerName, String issue) {
return List.of(
ResponseInputItem.ofEasyInputMessage(
EasyInputMessage.builder()
.role(EasyInputMessage.Role.SYSTEM)
.content(
"You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details.")
.build()),
ResponseInputItem.ofEasyInputMessage(
EasyInputMessage.builder()
.role(EasyInputMessage.Role.USER)
.content(
"Customer name: "
+ customerName
+ ". Issue: "
+ issue
+ ". Write a response to the customer.")
.build()));
}
ResponseCreateParams params =
ResponseCreateParams.builder()
.model("gpt-6-astra")
.inputOfResponse(buildSupportPrompt("Acme", "billing question"))
.build();
client.responses().create(params).output().stream()
.flatMap(item -> item.message().stream())
.flatMap(message -> message.content().stream())
.flatMap(content -> content.outputText().stream())
.forEach(text -> System.out.println(text.text()));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21using OpenAI.Responses;
#pragma warning disable OPENAI001
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
ResponsesClient client = new(key);
static ResponseItem[] BuildSupportPrompt(string customerName, string issue) =>
[
ResponseItem.CreateSystemMessageItem(
"You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details."
),
ResponseItem.CreateUserMessageItem(
$"Customer name: {customerName}. Issue: {issue}. Write a response to the customer."
),
];
ResponseResult response = await client.CreateResponseAsync(
"gpt-6-astra",
BuildSupportPrompt("Acme", "billing question")
);
Console.WriteLine(response.GetOutputText());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23require "openai"
def build_support_prompt(customer_name, issue)
[
{
role: :system,
content: "You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details."
},
{
role: :user,
content: "Customer name: #{customer_name}. Issue: #{issue}. Write a response to the customer."
}
]
end
client = OpenAI::Client.new
response = client.responses.create(
model: "gpt-6-astra",
input: build_support_prompt("Acme", "billing question")
)
puts(response.output_text)
Du hast mehr Kontrolle über die Entwicklung: Prompts liegen zusammen mit dem Produktcode, Änderungen durchlaufen PRs, Tests und Evaluationen können in der CI ausgeführt werden, und Rollouts oder Experimente lassen sich über deine eigene Konfiguration oder Feature-Flags steuern.
Verteile Prompts nicht direkt über die gesamte Codebasis. Erstelle ein kleines Modul namens prompts/, definiere jeden Prompt als benannte Builder-Funktion und ergänze einfache Fixtures für Evaluationen. So werden Änderungen an Prompts genauso überprüft wie die Produktlogik.