OpenAI stellt die Unterstützung für wiederverwendbare Prompt-Objekte in der API schrittweise ein. Ab dem 3. Juni 2026 rückt das Erstellen solcher Prompts in den Hintergrund. Die Abschaltung von v1/prompts ist für den 30. November 2026 geplant. Den aktuellen Zeitplan findest du in der Übersicht der angekündigten Abschaltungen.
Wenn du Prompts auf der API-Plattform von OpenAI ablösen möchtest, übernimm den Prompt-Inhalt aus dem verwalteten prompt-Objekt in deinen Anwendungscode. So hast du mehr Kontrolle darüber, wie du Prompts überprüfst, testest, bereitstellst und versionierst.
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={
"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
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{
Prompt: responses.ResponsePromptParam{
// Replace with your published prompt ID.
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 Plugin OpenAI Developers und den Skill OpenAI Docs, um die Migration zu automatisieren und schneller mit der OpenAI API zu entwickeln.
$openai-docs Passe dieses Projekt so an, dass es Prompts im Code speichert, statt ein Prompt-Objekt zu verwenden.
Statt in einer API-Anfrage auf ein gespeichertes Prompt-Objekt zu verweisen, speicherst du den Prompt-Text in deiner Codebasis. Die daraus erzeugten Nachrichten übergibst du beim Aufruf der Responses API direkt als input.
- Übernimm die Prompt-Inhalte in den Quellcode, damit Änderungen an Prompts denselben Prüf- und Freigabeprozess durchlaufen wie Änderungen an der Produktlogik.
- Ersetze Prompt-Variablen durch Funktionsargumente, damit deine Anwendung dynamische Werte explizit und mit festgelegtem Typ übergibt.
- Übergib die Nachrichten über
input, wenn du die Responses API aufrufst, statt das prompt-Objekt zu verwenden.
- Versioniere Prompts in deinem Repository und nutze dafür Git-Commits, Reviews von Pull Requests und Tests oder Evals.
- Platziere statische Inhalte am Anfang und dynamische Inhalte weiter hinten, damit du die Vorteile des Prompt-Cachings behältst. Ein Cache-Treffer setzt voraus, dass das Präfix exakt übereinstimmt.
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 OpenAI from "openai";
const client = new OpenAI();
function buildSupportPrompt({
customerName,
issue,
}: {
customerName: string;
issue: string;
}): OpenAI.Responses.ResponseInput {
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 kannst Prompts zusammen mit dem Produktcode verwalten und Änderungen über Pull Requests prüfen. Tests und Evals lassen sich in der CI ausführen. Rollouts und Experimente kannst du über deine eigene Konfiguration oder über Feature-Flags steuern.
Verteile die Prompts nicht über die gesamte Codebasis. Lege ein kleines Modul unter prompts/ an und definiere für jeden Prompt eine benannte Funktion, die ihn erzeugt. Ergänze einfache Testdaten für Evals, damit Änderungen an Prompts genauso geprüft werden wie Änderungen an der Produktlogik.