Tom
02/13/2026, 7:10 PMconst bamlProvider = (providerId === 'openai' && auth?.type === 'oauth')
? 'openai-responses' as const
: def.bamlProvider
// The options passed to BAML:
cr.addLlmClient('ChatClientNoRetryAnthropicOnly', 'openai-responses', {
model: modelId,
api_key: auth.accessToken,
base_url: 'https://chatgpt.com/backend-api/codex',
headers: {
'ChatGPT-Account-Id': auth.accountId,
},
})
But I keep getting this error back from OpenAI:
Request failed with status code: 400 Bad Request,
{"detail":"Instructions are required"}
I thought the BAML openai-response provider would properly map system instructions to the right parameters. But is something different with the codex endpoint? Do I need to use the Modular API to manually construct the proper request here?greg (BAML)
02/13/2026, 7:19 PMTom
02/13/2026, 7:19 PMTom
02/13/2026, 7:22 PMTom
02/13/2026, 7:25 PMgreg (BAML)
02/13/2026, 7:31 PMinstructions field, which isn't part of the request we build via BAML.
When you make the prior request (the one that fails with 400), can you grab a screenshot of the request preview from the Playground for me?Tom
02/13/2026, 7:35 PMTom
02/13/2026, 7:36 PMTom
02/13/2026, 7:37 PMgreg (BAML)
02/13/2026, 7:55 PMgreg (BAML)
02/13/2026, 7:55 PMTom
02/13/2026, 7:59 PMTom
02/13/2026, 8:22 PMgreg (BAML)
02/13/2026, 8:27 PMTom
02/13/2026, 8:30 PMTom
02/13/2026, 8:31 PMbaml-sam
02/14/2026, 5:31 PMAnders
02/15/2026, 5:36 AMvEth
03/09/2026, 8:59 AMvEth
03/09/2026, 9:16 AMinstructions as a Passthrough Option
BAML forwards unrecognized options directly to the request body. Adding a static instructions field in client options bypasses the error:
baml
client<llm> MyClient {
provider "openai-responses"
options {
model "gpt-5.4"
base_url "https://your.example.com/v1"
api_key env.YOUR_API_KEY
instructions "Follow the user's instructions carefully."
reasoning {
effort "medium"
}
}
}
The prompt's system role content is still sent as part of input messages, so the model receives the full context. The static instructions field simply satisfies the endpoint's requirement.Tiziano Zanuto
05/27/2026, 8:19 AM