Skip to content

Show OpenAI SDK examples for gpt-oss and qwen35 - #5662

Merged
philip merged 1 commit into
mainfrom
catalog/gpt-oss-qwen-conforms
Aug 28, 2026
Merged

Show OpenAI SDK examples for gpt-oss and qwen35#5662
philip merged 1 commit into
mainfrom
catalog/gpt-oss-qwen-conforms

Conversation

@andrelandgraf

@andrelandgraf andrelandgraf commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Problem

The latest chat-completions measurement records gpt-oss-20b, gpt-oss-120b, and qwen35-122b-a10b as conforming: message.content is a string and deviations is empty.

The site still classified all three as array-content. /models and neon.com/models therefore omitted their TypeScript and Python OpenAI SDK examples. The docs warning also listed two of these models as returning array content.

Diagnosis

The example selector excludes OpenAI SDK snippets when capabilities.chat is array-content, because those SDKs type message.content as a string. The stale capability records activated that branch for these three models.

The refreshed measurement still records array content for Gemini 3.x and Claude 5. Those are now the model groups named in the warning.

Solution

  • Mark gpt-oss-20b, gpt-oss-120b, and qwen35-122b-a10b as conforms with no deviations.
  • Verify that /models and the model page expose AI SDK, Mastra, TypeScript, Python, and cURL examples for each model.
  • Verify that every remaining array-content model has a provider-native fallback.
  • Retarget the docs warning at Gemini 3.x and Claude 5.
  • Refresh the recorded Gemini token-accounting deviations from the same measurement.

The /models response structure and existing example templates remain unchanged. These models now select the conforming example set.

User-facing API/UI

GET /models?model=gpt-oss-20b now includes these relevant fields:

{
  "use_case": "chat",
  "model": {
    "id": "gpt-oss-20b",
    "capabilities": {
      "entitled": true,
      "chat": "conforms",
      "deviations": [],
      "native_dialect": "none",
      "responses": false,
      "web_search": false,
      "image_generation": false
    },
    "examples": [
      { "id": "ai-sdk", "endpoint": "/v1/chat/completions (via provider)" },
      { "id": "mastra", "endpoint": "/v1/chat/completions" },
      { "id": "typescript", "endpoint": "/v1/chat/completions" },
      { "id": "python", "endpoint": "/v1/chat/completions" },
      { "id": "curl", "endpoint": "/v1/chat/completions" }
    ]
  }
}

The same example set applies to gpt-oss-120b and qwen35-122b-a10b. Their model pages now offer AI SDK, Mastra, TypeScript, Python, and cURL in the language dropdown.

The docs warning ships as:

<Admonition type="warning" title="Content shape varies by model">
For most models, `message.content` in a chat completions response is a plain string. For some models, confirmed on Gemini 3.x (`gemini-3-5-flash`, `gemini-3-1-pro`) and Claude 5 (`claude-sonnet-5`, `claude-opus-5`, `claude-fable-5`), it's an array of typed content blocks instead (`{ type: 'reasoning', ... }`, `{ type: 'text', text: ... }`). A low `max_tokens` value can also cut a response off before the `text` block appears, leaving only a `reasoning` block. Handle both shapes:

```typescript
const { content } = response.choices[0].message;
const text = typeof content === 'string'
  ? content
  : content.find((block) => block.type === 'text')?.text ?? '';
```

</Admonition>

Usage examples

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.NEON_AI_GATEWAY_TOKEN,
  baseURL: `${process.env.NEON_AI_GATEWAY_BASE_URL}/v1`,
});

const resp = await client.chat.completions.create({
  model: "gpt-oss-20b",
  messages: [{ role: "user", content: "Explain Serverless Postgres." }],
});
console.log(resp.choices[0].message.content);
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["NEON_AI_GATEWAY_TOKEN"],
    base_url=f"{os.environ['NEON_AI_GATEWAY_BASE_URL']}/v1",
)

resp = client.chat.completions.create(
    model="gpt-oss-20b",
    messages=[{"role": "user", "content": "Explain Serverless Postgres."}],
)
print(resp.choices[0].message.content)

Replace the model ID with gpt-oss-120b or qwen35-122b-a10b for the other two models.

Verification

  • Vitest against route.test.js, model-examples.test.js, generate-ai-gateway-model-markdown.test.js, and model-rows.test.js: 42 passed.
  • npm run check:models-endpoint-sync: 42 models in sync.
  • Pre-push hook: full unit suite passed (787 tests).

Gaps

Live gateway output and the deployed model pages were not rechecked from this website worktree. The update relies on the committed conformance measurement and automated route/UI coverage. Gemini 3.x and Claude 5 still return array content on /v1/chat/completions; their OpenAI SDK examples stay hidden from the language dropdown.

Those three models now return string content on /v1/chat/completions.
/models can show the OpenAI SDK examples that were hidden. The docs
warning names Gemini 3.x and Claude 5 as the remaining array-content
cases.
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
neon-next Ready Ready Preview Aug 27, 2026 10:21pm

Request Review

@philip philip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, all looks good 👍

@philip
philip merged commit 3f31216 into main Aug 28, 2026
2 of 4 checks passed
@philip
philip deleted the catalog/gpt-oss-qwen-conforms branch August 28, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants