Skip to content

fix(agents): fix reasoning model routing for gpt-5.4 and gpt-5.5#347

Merged
AntonYeromin merged 4 commits into
codemie-ai:mainfrom
vladyslav-yurchenko1:EPMCDME-12666_reasoning-gpt-models-codemie-code
Jun 12, 2026
Merged

fix(agents): fix reasoning model routing for gpt-5.4 and gpt-5.5#347
AntonYeromin merged 4 commits into
codemie-ai:mainfrom
vladyslav-yurchenko1:EPMCDME-12666_reasoning-gpt-models-codemie-code

Conversation

@vladyslav-yurchenko1

Copy link
Copy Markdown
Contributor

Summary

Adds gpt-5.5 model support with correct routing to OpenAI Responses API and consolidates Responses API model detection into a single source of truth.

Changes

  • Added gpt-5.5 and gpt-5.5-2026-04-24 static entries with use_responses_api: true in opencode-model-configs.ts
  • Moved RESPONSES_API_MODEL_PATTERNS and isResponsesApiModel() from opencode-dynamic-models.ts to opencode-model-configs.ts (single source of truth)
  • Fixed getModelConfig() fallback to apply isResponsesApiModel() so unknown future models are auto-routed correctly
  • Removed duplicate pattern array from opencode-dynamic-models.ts

Impact

Before: gpt-5.5 was routed to /v1/chat/completions — no reasoning output, tool calls crashed with reasoning_effort not supported error.
After: gpt-5.5 routes to /v1/responses — reasoning blocks visible in CLI, tool calls work correctly.

Checklist

  • Self-reviewed
  • Manual testing performed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)

@vladyslav-yurchenko1 vladyslav-yurchenko1 changed the title fix(agents): add gpt-5.5 responses api routing fix(agents): fix reasoning model routing for gpt-5.4 and gpt-5.5 Jun 10, 2026

// Responses API (/v1/responses) supports reasoningSummary and must not have it stripped.
// Chat Completions (/v1/chat/completions) and any other path use the restricted set.
const isResponsesApi = context.url?.includes('/v1/responses') || context.url === '/responses';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

context.url is assigned directly from req.url — the /v1 prefix is ​​never stripped, so the second condition (=== '/responses') is dead code. The first condition (includes) is a substring match and would
incorrectly treat /v1/responses/stream as a Responses API request. Fix: context.url === '/v1/responses'

}
},

'gpt-5.4': {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'gpt-5.4': { cost: { input: 1.75, output: 14, cache_read: 0.175 }, ... }
'gpt-5.4-2026-03-05': { cost: { input: 1.75, output: 14, cache_read: 0.175 }, ... }

These four config blocks are nearly identical only id, name, and displayName differ. If pricing changes, it needs to be updated in multiple places and it's easy to miss one. maybe worth extracting shared fields into a base object?

@mykolanehrych

Copy link
Copy Markdown
Contributor

Approved

@AntonYeromin AntonYeromin merged commit 7dcf0c4 into codemie-ai:main Jun 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants