You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the OpenCode SDK with OpenAI provider, sessions fail because the internal title agent tries to use gpt-5-nano, which is not in OpenCode's model registry (models.dev), causing ProviderModelNotFoundError.
Irony:gpt-5-nano actually exists and works when called directly via OpenAI API, but OpenCode's internal model lookup fails.
Steps to Reproduce
import{createOpencode}from'@opencode-ai/sdk';const{ client, server }=awaitcreateOpencode({port: 4096});// Set up OpenAI authawaitclient.auth.set({path: {id: 'openai'},body: {type: 'api',key: process.env.OPENAI_API_KEY},});// Create session and send promptconstsession=awaitclient.session.create({query: {directory: '/tmp/test'}});awaitclient.session.prompt({path: {id: session.data.id},query: {directory: '/tmp/test'},body: {model: {providerID: 'openai',modelID: 'gpt-5.2-2025-12-11'},parts: [{type: 'text',text: 'Say hello'}],},});// Session is cancelled immediately
// Direct OpenAI API call works fine:constresponse=awaitfetch('https://api.openai.com/v1/chat/completions',{method: 'POST',headers: {'Authorization': `Bearer ${apiKey}`,'Content-Type': 'application/json'},body: JSON.stringify({model: 'gpt-5-nano',messages: [{role: 'user',content: 'Hi'}],max_completion_tokens: 5})});// ✅ Works - returns response from gpt-5-nano-2025-08-07
Root Cause
OpenCode's internal title agent hardcodes gpt-5-nano as the small model for OpenAI
OpenCode's model registry (from models.dev/api.json) doesn't include gpt-5-nano
This causes ProviderModelNotFoundError even though the model exists at OpenAI
Workaround
Using Anthropic provider works correctly - no issues with internal agents.
Suggested Fix
Either:
Add gpt-5-nano to the models.dev registry
Make the title/small model configurable in opencode.json
Skip model validation for internal agents if the provider supports the model
Activity
github-actions commentedon Dec 31, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Dec 31, 2025
It's definitely in the model list...
https://models.dev/?search=gpt-5-nano
rekram1-node commentedon Dec 31, 2025
This isn't even nano?
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.