Why typescript sdk outputSchema doesn't work
Open 💬 7 comments Opened Feb 2, 2026 by GRCmade
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.93.0
What subscription do you have?
p
Which model were you using?
gpt5.2
What platform is your computer?
mac
What terminal emulator and version are you using (if applicable)?
terminal
What issue are you seeing?
I tried running the script below, but the result was not the expected JSON-formatted structured text; instead, it was plain text.
import { Codex } from "@openai/codex-sdk";
const codex = new Codex();
const thread = codex.startThread();
const schema = {
type: "object",
properties: {
summary: { type: "string" },
status: { type: "string", enum: ["ok", "action_required"] },
},
required: ["summary", "status"],
additionalProperties: false,
}
const turn = await thread.run("hello", { outputSchema: schema });
console.log(turn);
the result
➜ codex-exec-demo git:(main) ✗ node demo.mjs
{
items: [
{
id: 'item_0',
type: 'agent_message',
text: 'Hi! What can I help you with?'
}
],
finalResponse: 'Hi! What can I help you with?',
usage: { input_tokens: 11134, cached_input_tokens: 6656, output_tokens: 33 }
}
What steps can reproduce the bug?
run this script
What is the expected behavior?
I need to output structured content
Additional information
_No response_
7 Comments
Thanks for the report. I wasn't able to reproduce the problem using your script. Here's what I received as an output.
Are you consistently seeing this problem, or was it a one-time issue?
Are you sure you are using the latest published SDK?
Thank you for your reply. I do have an issue here; even the CLI is like this. I'm not very sure where the problem is coming from.
How should I troubleshoot it?
this is my demo
codex-exec-demo.zip
Do you have any non-default config settings defined in your
~/.codex/config.tomlconfig file?This is my ~/.codex/config.toml. Is there anything that could affect outputSchema?
config.toml.zip
You appear to be routing through a proxy of some sort (https://right.codes/codex/v1). I'm guessing that it's not passing along the outputSchema. Try disabling the proxy and directly accessing the OpenAI endpoint to see if that works.
Okay, thanks again for your feedback. I'll check it.
Did you solve that?I have this question too,these's my code: