跳到正文
原文
OpenRouter Blog·· 23 天前AI 评分46

如何让任意 LLM 输出结构化结果:JSON Schema、工具调用还是决策模型

How to Get Structured Output from Any LLM: JSON Schema, Tool Calls, or a Decision Model

AI 导读

OpenRouter 用 24 条杂乱客服消息在 9 个支持结构化输出的模型上测试,216 次回复中 209 次符合严格 schema,7 次失败全部来自同一个忽略 schema 的提供商;仅在提示词里要求 JSON 时有 18 次因代码围栏失败。

社媒成稿工作台 · 一键复制

飞书同步推送 · 含数据/日期/出处/启发
核心数据发布日期信源出处独立开发启发
1575
如何让任意 LLM 输出结构化结果:JSON Schema、工具调用还是决策模型

📊 核心数据与事实(2026-11-10):
OpenRouter 用 24 条杂乱客服消息在 9 个支持结构化输出的模型上测试,216 次回复中 209 次符合严格 schema,7 次失败全部来自同一个忽略 schema 的提供商;仅在提示词里要求 JSON 时有 18 次因代码围栏失败。
• 原文实测切片:I want my $1,249.50 back." print (extract( "openai/gpt-6-luna" , message)) print (extract( "deepseek/deepseek-v4.1-flash" , message, route = "tool" )) print (extract( "z-ai/glm-5.3-flashx" , message, provider = { "require_parameters" : True }))…
• 原文实测切片:import os import requests r = requests.post( " , headers = { "Authorization" : f "Bearer { os.environ[ 'OPENROUTER_API_KEY' ] } " }, timeout = 60 , json = { "model" : "typesafe/jev-1.13" , "state" : { "message" : "ORD-660021, 1 rug (RUG-808),…
• 原文实测切片:If I don't hear back today " "I'm filing a chargeback with my bank." }, "questions" : { "intent" : { "type" : "choice" , "instructions" : "What is the customer asking for?" , "criteria" : { "refund" : "Money back, even if the item was damaged."…

💡 对独立开发者的启发:
1/ 供给端造工具的门槛已被 AI 和开源抹平,独立开发者真正的护城河是「找准垂直业务场景 + 做好分发」。
2/ 面对新模型或开源组件先看三件事:许可证是否商用安全、API/推理边际成本降了多少、能不能直接嵌进现有变现工作流。
3/ 别去卷通用开发者轮子,把底层新能力包装成面向具体行业人群(电商、创作者、中小商家)傻瓜式交付结果的产品。

📅 日期:2026-11-10(北京时间)
📰 信息源出处:OpenRouter Blog(openrouter.ai)
🔗 原文:https://openrouter.ai/blog/tutorials/structured-output-llm/
📡 归档:https://billionare.me/items/pvvxfeqvvq5f3ny2ssjq6m1c5
去 X 发推
每天 08:00 邮件 / 08:30 飞书准点推送一手高信噪比情报与拆解免费订阅简报

来源:OpenRouter Blog · openrouter.ai