Skip to content

Why typescript sdk outputSchema doesn't work #10393

@GRCmade

Description

@GRCmade

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsdkIssues related to the Codex SDK

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions