# Structured ouput with gpt-oss-120b

**URL:** <https://discuss.huggingface.co/t/structured-ouput-with-gpt-oss-120b/167397>\
**Category:** Intermediate\
**Created:** [August 20, 2025, 8:13am UTC](https://discuss.huggingface.co/t/structured-ouput-with-gpt-oss-120b/167397 "2025-08-20T08:13:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bilaaaaaaaaaaaal](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@bilaaaaaaaaaaaal](https://discuss.huggingface.co/u/bilaaaaaaaaaaaal)\
**Post date:** [August 20, 2025, 8:13am UTC](https://discuss.huggingface.co/t/structured-ouput-with-gpt-oss-120b/167397/1 "2025-08-20T08:13:52Z")

</div>

Hi guys! I am trying to use structured output with gpt-oss-120b, but the snippet provided by HF on [this](https://huggingface.co/docs/inference-providers/guides/gpt-oss?structured=javascript#chat-completion) link keeps on failing with this error:

/hf\_inference/node\_modules/openai/core/error.mjs:41return new BadRequestError(status, error, message, headers);^

```auto
BadRequestError: 400 Failed to format non-streaming choice: Unexpected EOS while waiting for message header to completeat APIError.generate (file:///Users/app/development/hf_inference/node_modules/openai/core/error.mjs:41:20)at OpenAI.makeStatusError (file:///Users/app/development/hf_inference/node_modules/openai/client.mjs:156:32)at OpenAI.makeRequest (file:///Users/app/development/hf_inference/node_modules/openai/client.mjs:301:30)at process.processTicksAndRejections (node:internal/process/task_queues:95:5)at async file:///Users/app/development/hf_inference/index.js:9:18 {status: 400,

```

anybody knows how to fix this?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [August 20, 2025, 8:36am UTC](https://discuss.huggingface.co/t/structured-ouput-with-gpt-oss-120b/167397/2 "2025-08-20T08:36:22Z")

</div>

The inference method supported varies depending on the inference provider. [In this case, it might be better to use Fireworks rather than Celebras for structured tasks](https://huggingface.co/docs/inference-providers/guides/gpt-oss).

> For structured tasks like data extraction, you can force the model to return a valid JSON object using the `response_format` parameter. We use the Fireworks AI provider.
