Skip to content

Commit 76698f1

Browse files
authored
fix: prefer chat api over responses api for openai agents (#38)
1 parent 445d0a0 commit 76698f1

File tree

6 files changed

+12
-19
lines changed

6 files changed

+12
-19
lines changed
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve Blink
4-
title: ''
4+
title: ""
55
labels: Bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
## Describe the bug
10+
1111
A clear and concise description of what the bug is.
1212

1313
## Environment
14+
1415
- **OS**: [e.g., macOS 14.2, Windows 11, Ubuntu 22.04]
1516
- **Node.js version**: [Run `node --version`]
1617
- **Blink version**: [Run `blink --version`]
1718
- **Installation method**: [npm, yarn, pnpm, or bun]
1819

1920
## Additional Context
21+
2022
Add any other context, error messages, or screenshots.

packages/blink/src/cli/init-templates/index.ts

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/blink/src/cli/init-templates/scratch/agent.ts.hbs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ agent.on("chat", async ({ messages }) => {
1414
{{#if (eq aiProvider "anthropic")}}
1515
model: anthropic("claude-sonnet-4-5"),
1616
{{else if (eq aiProvider "openai")}}
17-
model: openai("gpt-5-codex"),
18-
providerOptions: {
19-
openai: {
20-
reasoningSummary: "detailed",
21-
},
22-
},
17+
model: openai.chat("gpt-5"),
2318
{{else if (eq aiProvider "vercel")}}
2419
model: "anthropic/claude-sonnet-4.5",
2520
{{else}}

packages/blink/src/cli/init-templates/slack-bot/agent.ts.hbs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@ agent.on("chat", async ({ messages }) => {
9090
{{#if (eq aiProvider "anthropic")}}
9191
model: anthropic("claude-sonnet-4-5"),
9292
{{else if (eq aiProvider "openai")}}
93-
model: openai("gpt-5-codex"),
94-
providerOptions: {
95-
openai: {
96-
reasoningSummary: "detailed",
97-
},
98-
},
93+
model: openai.chat("gpt-5"),
9994
{{else if (eq aiProvider "vercel")}}
10095
model: "anthropic/claude-sonnet-4.5",
10196
{{else}}

packages/blink/src/cli/init.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ describe("getFilesForTemplate", () => {
199199

200200
const agentTs = getFile(files, "agent.ts");
201201
expect(agentTs).toContain('import { openai } from "@ai-sdk/openai"');
202-
expect(agentTs).toContain('model: openai("gpt-5-codex")');
202+
expect(agentTs).toContain('model: openai.chat("gpt-5")');
203203
expect(agentTs).not.toContain("import { anthropic }");
204204
});
205205

packages/blink/src/edit/agent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,8 @@ export function getEditModeModel(
666666
if (env.OPENAI_API_KEY) {
667667
return createOpenAI({
668668
apiKey: env.OPENAI_API_KEY,
669-
}).responses("gpt-5");
669+
// avoid the responses API due to https://github.com/coder/blink/issues/34#issuecomment-3426704264
670+
}).chat("gpt-5");
670671
}
671672

672673
// Priority 3: Use AI Gateway if API key is set

0 commit comments

Comments
 (0)