feat: emit top-level context_window and capability flags in /v1/models

Discovery clients (jcode, Pi, etc.) read context_length/context_window and
supported_reasoning_levels at the TOP LEVEL of each /v1/models entry, not
inside a nested metadata object. Emit both: keep the rich nested metadata
object AND mirror context_window/context_length/max_input/max_output/
reasoning/tool_call/structured_output at the top level so standard OpenAI
model-discovery clients get correct context windows without config.
This commit is contained in:
sk-dev-ai committed 2026-09-04 10:56:13 +05:30
1 parent 04ce09cc9c
commit f3593e3790
2 files changed
+1001 -1

No files matched your search

+973
View File
@@ -0,0 +1,973 @@
{
"schema_version": 2,
"updated_at": "2026-09-04T05:22:53.853695398Z",
"zen": [
"big-pickle",
"claude-fable-5",
"claude-fable-5-1",
"claude-haiku-4-5",
"claude-opus-4-5",
"claude-opus-4-6",
"claude-opus-4-7",
"claude-opus-4-8",
"claude-opus-5",
"claude-sonnet-4",
"claude-sonnet-4-5",
"claude-sonnet-4-6",
"claude-sonnet-5",
"deepseek-v4-flash",
"deepseek-v4-flash-free",
"deepseek-v4-pro",
"gemini-3-flash",
"gemini-3.1-pro",
"gemini-3.5-flash",
"gemini-3.5-flash-lite",
"gemini-3.6-flash",
"gemini-3.7-flash",
"gemini-3.8-flash",
"glm-5",
"glm-5.1",
"glm-5.2",
"gpt-5",
"gpt-5-codex",
"gpt-5-nano",
"gpt-5.1",
"gpt-5.1-codex",
"gpt-5.1-codex-max",
"gpt-5.1-codex-mini",
"gpt-5.2",
"gpt-5.2-codex",
"gpt-5.3-codex",
"gpt-5.3-codex-spark",
"gpt-5.4",
"gpt-5.4-mini",
"gpt-5.4-nano",
"gpt-5.4-pro",
"gpt-5.5",
"gpt-5.5-pro",
"gpt-5.6-luna",
"gpt-5.6-sol",
"gpt-5.6-terra",
"grok-4.5",
"grok-4.6",
"grok-build-0.1",
"kimi-k2.5",
"kimi-k2.6",
"kimi-k2.7-code",
"kimi-k3",
"laguna-s-2.1-free",
"ling-3.0-flash-fin-free",
"mimo-v2.5-free",
"minimax-m2.5",
"minimax-m2.7",
"minimax-m3",
"muse-spark-1.2",
"muse-spark-1.2-contributor-free",
"muse-spark-1.3-contributor-free",
"nemotron-3-ultra-free",
"nemotron-3.5-lightning-free",
"qwen3.5-plus",
"qwen3.6-plus"
],
"go": [],
"native_protocols": {
"go": {
"deepseek-v4-flash": "chat",
"deepseek-v4-flash-vision-exp": "chat",
"deepseek-v4-pro": "chat",
"glm-5": "chat",
"glm-5.1": "chat",
"glm-5.2": "chat",
"glm-5.3": "chat",
"glm-5.3-flash": "chat",
"gpt-5.6-luna": "responses",
"grok-4.5": "responses",
"grok-4.6": "responses",
"hy3": "chat",
"hy4-preview": "chat",
"kimi-k2.5": "chat",
"kimi-k2.6": "chat",
"kimi-k2.7-code": "chat",
"kimi-k3": "chat",
"longcat-2.0": "chat",
"mimo-v2-omni": "chat",
"mimo-v2-pro": "chat",
"mimo-v2.5": "chat",
"mimo-v2.5-pro": "chat",
"minimax-m2.5": "anthropic",
"minimax-m2.7": "anthropic",
"minimax-m3": "anthropic",
"muse-spark-1.2-contributor": "responses",
"muse-spark-1.3-contributor": "responses",
"omen-alpha": "chat",
"ox-alpha-free": "chat",
"qwen3.5-plus": "chat",
"qwen3.6-plus": "anthropic",
"qwen3.7-max": "anthropic",
"qwen3.7-plus": "anthropic",
"qwen3.8-flash": "anthropic",
"qwen3.8-max": "anthropic"
},
"zen": {
"big-pickle": "chat",
"claude-3-5-haiku": "anthropic",
"claude-fable-5": "anthropic",
"claude-fable-5-1": "anthropic",
"claude-haiku-4-5": "anthropic",
"claude-opus-4-1": "anthropic",
"claude-opus-4-5": "anthropic",
"claude-opus-4-6": "anthropic",
"claude-opus-4-7": "anthropic",
"claude-opus-4-8": "anthropic",
"claude-opus-5": "anthropic",
"claude-sonnet-4": "anthropic",
"claude-sonnet-4-5": "anthropic",
"claude-sonnet-4-6": "anthropic",
"claude-sonnet-5": "anthropic",
"deepseek-v4-flash": "chat",
"deepseek-v4-flash-free": "chat",
"deepseek-v4-pro": "chat",
"glm-4.6": "chat",
"glm-4.7": "chat",
"glm-4.7-free": "chat",
"glm-5": "chat",
"glm-5-free": "chat",
"glm-5.1": "chat",
"glm-5.2": "chat",
"gpt-5": "responses",
"gpt-5-codex": "responses",
"gpt-5-nano": "responses",
"gpt-5.1": "responses",
"gpt-5.1-codex": "responses",
"gpt-5.1-codex-max": "responses",
"gpt-5.1-codex-mini": "responses",
"gpt-5.2": "responses",
"gpt-5.2-codex": "responses",
"gpt-5.3-codex": "responses",
"gpt-5.3-codex-spark": "responses",
"gpt-5.4": "responses",
"gpt-5.4-mini": "responses",
"gpt-5.4-nano": "responses",
"gpt-5.4-pro": "responses",
"gpt-5.5": "responses",
"gpt-5.5-pro": "responses",
"gpt-5.6-luna": "responses",
"gpt-5.6-sol": "responses",
"gpt-5.6-terra": "responses",
"grok-4.5": "responses",
"grok-4.6": "responses",
"grok-build-0.1": "responses",
"grok-code": "chat",
"hy3-free": "chat",
"hy3-preview-free": "chat",
"kimi-k2": "chat",
"kimi-k2-thinking": "chat",
"kimi-k2.5": "chat",
"kimi-k2.5-free": "chat",
"kimi-k2.6": "chat",
"kimi-k2.7-code": "chat",
"kimi-k3": "chat",
"laguna-s-2.1-free": "chat",
"ling-2.6-flash-free": "chat",
"ling-3.0-flash-fin-free": "chat",
"ling-3.0-flash-free": "chat",
"ling-3.0-tiny-free": "chat",
"longcat-2.0-free": "chat",
"mimo-v2-flash-free": "chat",
"mimo-v2-omni-free": "chat",
"mimo-v2-pro-free": "chat",
"mimo-v2.5-free": "chat",
"minimax-m2.1": "chat",
"minimax-m2.1-free": "anthropic",
"minimax-m2.5": "chat",
"minimax-m2.5-free": "anthropic",
"minimax-m2.7": "chat",
"minimax-m3": "chat",
"minimax-m3-free": "anthropic",
"muse-spark-1.2": "responses",
"muse-spark-1.2-contributor-free": "responses",
"muse-spark-1.3-contributor-free": "responses",
"nemotron-3-super-free": "chat",
"nemotron-3-ultra-free": "chat",
"nemotron-3.5-lightning-free": "chat",
"north-mini-code-free": "chat",
"qwen3-coder": "chat",
"qwen3.5-plus": "anthropic",
"qwen3.6-plus": "anthropic",
"qwen3.6-plus-free": "anthropic",
"qwen3.7-max": "anthropic",
"qwen3.7-plus": "anthropic",
"ring-2.6-1t-free": "chat",
"trinity-large-preview-free": "chat",
"x-preview-f-free": "chat"
}
},
"unsupported": {
"go": {},
"zen": {
"gemini-3-flash": true,
"gemini-3-pro": true,
"gemini-3.1-pro": true,
"gemini-3.5-flash": true,
"gemini-3.5-flash-lite": true,
"gemini-3.6-flash": true,
"gemini-3.7-flash": true,
"gemini-3.8-flash": true
}
},
"metadata": {
"big-pickle": {
"context_window": 200000,
"max_input": 160000,
"max_output": 32000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"claude-3-5-haiku": {
"context_window": 200000,
"max_output": 8192,
"tool_call": true
},
"claude-fable-5": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"claude-fable-5-1": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"claude-haiku-4-5": {
"context_window": 200000,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"claude-opus-4-1": {
"context_window": 200000,
"max_output": 32000,
"reasoning": true,
"tool_call": true
},
"claude-opus-4-5": {
"context_window": 200000,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"claude-opus-4-6": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"claude-opus-4-7": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"claude-opus-4-8": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"claude-opus-5": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"claude-sonnet-4": {
"context_window": 1000000,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"claude-sonnet-4-5": {
"context_window": 1000000,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"claude-sonnet-4-6": {
"context_window": 1000000,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"claude-sonnet-5": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"deepseek-v4-flash": {
"context_window": 1000000,
"max_output": 384000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"deepseek-v4-flash-free": {
"context_window": 200000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"deepseek-v4-flash-vision-exp": {
"context_window": 1000000,
"max_output": 384000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"deepseek-v4-pro": {
"context_window": 1000000,
"max_output": 384000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3-flash": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3-pro": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3.1-pro": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3.5-flash": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3.5-flash-lite": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3.6-flash": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3.7-flash": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gemini-3.8-flash": {
"context_window": 1048576,
"max_output": 65536,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"glm-4.6": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"glm-4.7": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"glm-4.7-free": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"glm-5": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"glm-5-free": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"glm-5.1": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"glm-5.2": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"glm-5.3": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"glm-5.3-flash": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5-codex": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5-nano": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.1": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.1-codex": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.1-codex-max": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.1-codex-mini": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.2": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.2-codex": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.3-codex": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.3-codex-spark": {
"context_window": 128000,
"max_input": 128000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.4": {
"context_window": 1050000,
"max_input": 922000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.4-mini": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.4-nano": {
"context_window": 400000,
"max_input": 272000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.4-pro": {
"context_window": 1050000,
"max_input": 922000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"gpt-5.5": {
"context_window": 1050000,
"max_input": 922000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.5-pro": {
"context_window": 1050000,
"max_input": 922000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"gpt-5.6-luna": {
"context_window": 1050000,
"max_input": 922000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.6-sol": {
"context_window": 1050000,
"max_input": 922000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"gpt-5.6-terra": {
"context_window": 1050000,
"max_input": 922000,
"max_output": 128000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"grok-4.5": {
"context_window": 500000,
"max_output": 500000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"grok-4.6": {
"context_window": 500000,
"max_output": 500000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"grok-build-0.1": {
"context_window": 256000,
"max_output": 256000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"grok-code": {
"context_window": 256000,
"max_output": 256000,
"reasoning": true,
"tool_call": true
},
"hy3": {
"context_window": 256000,
"max_input": 192000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"hy3-free": {
"context_window": 190000,
"max_input": 192000,
"max_output": 64000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"hy3-preview-free": {
"context_window": 256000,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"hy4-preview": {
"context_window": 1024000,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"kimi-k2": {
"context_window": 262144,
"max_output": 262144,
"tool_call": true
},
"kimi-k2-thinking": {
"context_window": 262144,
"max_output": 262144,
"reasoning": true,
"tool_call": true
},
"kimi-k2.5": {
"context_window": 262144,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"kimi-k2.5-free": {
"context_window": 262144,
"max_output": 262144,
"reasoning": true,
"tool_call": true
},
"kimi-k2.6": {
"context_window": 262144,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"kimi-k2.7-code": {
"context_window": 262144,
"max_output": 262144,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"kimi-k3": {
"context_window": 1048576,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"laguna-s-2.1-free": {
"context_window": 256000,
"max_output": 32000,
"reasoning": true,
"tool_call": true
},
"ling-2.6-flash-free": {
"context_window": 262100,
"max_output": 32800,
"tool_call": true
},
"ling-3.0-flash-fin-free": {
"context_window": 262144,
"max_output": 32768,
"reasoning": true,
"tool_call": true
},
"ling-3.0-flash-free": {
"context_window": 262144,
"max_output": 32768,
"reasoning": true,
"tool_call": true
},
"ling-3.0-tiny-free": {
"context_window": 262144,
"max_output": 32768,
"reasoning": true,
"tool_call": true
},
"longcat-2.0": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"longcat-2.0-free": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"mimo-v2-flash-free": {
"context_window": 262144,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"mimo-v2-omni": {
"context_window": 262144,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"mimo-v2-omni-free": {
"context_window": 262144,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"mimo-v2-pro": {
"context_window": 1048576,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"mimo-v2-pro-free": {
"context_window": 1048576,
"max_output": 64000,
"reasoning": true,
"tool_call": true
},
"mimo-v2.5": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"mimo-v2.5-free": {
"context_window": 200000,
"max_output": 32000,
"reasoning": true,
"tool_call": true
},
"mimo-v2.5-pro": {
"context_window": 1048576,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"minimax-m2.1": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"minimax-m2.1-free": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"minimax-m2.5": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"minimax-m2.5-free": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"minimax-m2.7": {
"context_window": 204800,
"max_output": 131072,
"reasoning": true,
"tool_call": true
},
"minimax-m3": {
"context_window": 512000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"minimax-m3-free": {
"context_window": 200000,
"max_output": 32000,
"reasoning": true,
"tool_call": true
},
"muse-spark-1.2": {
"context_window": 1048576,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"muse-spark-1.2-contributor": {
"context_window": 1048576,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"muse-spark-1.2-contributor-free": {
"context_window": 1048576,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"muse-spark-1.3-contributor": {
"context_window": 1048576,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"muse-spark-1.3-contributor-free": {
"context_window": 1048576,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"nemotron-3-super-free": {
"context_window": 204800,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"nemotron-3-ultra-free": {
"context_window": 1000000,
"max_output": 128000,
"reasoning": true,
"tool_call": true
},
"nemotron-3.5-lightning-free": {
"context_window": 262144,
"max_output": 262144,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"north-mini-code-free": {
"context_window": 256000,
"max_output": 64000,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"ox-alpha-free": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"qwen3-coder": {
"context_window": 262144,
"max_output": 65536,
"tool_call": true
},
"qwen3.5-plus": {
"context_window": 262144,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"qwen3.6-plus": {
"context_window": 262144,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"qwen3.6-plus-free": {
"context_window": 262144,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"qwen3.7-max": {
"context_window": 1000000,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"qwen3.7-plus": {
"context_window": 1000000,
"max_output": 65536,
"reasoning": true,
"tool_call": true
},
"qwen3.8-flash": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"qwen3.8-max": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
},
"ring-2.6-1t-free": {
"context_window": 262000,
"max_output": 66000,
"reasoning": true,
"tool_call": true
},
"trinity-large-preview-free": {
"context_window": 131072,
"max_output": 131072,
"tool_call": true
},
"x-preview-f-free": {
"context_window": 1000000,
"max_output": 131072,
"reasoning": true,
"tool_call": true,
"structured_output": true
}
}
}
+28 -1
View File
@@ -214,7 +214,34 @@ func (g *Gateway) handleModels(w http.ResponseWriter, _ *http.Request) {
if _, err := g.catalog.Route(model, len(g.cfg.ZenKeys) > 0, len(g.cfg.GoKeys) > 0, g.cfg.Anonymous); err != nil {
continue
}
data = append(data, map[string]any{"id": model, "object": "model", "created": now, "owned_by": "opencode", "metadata": g.catalog.Metadata(model)})
md := g.catalog.Metadata(model)
entry := map[string]any{
"id": model, "object": "model", "created": now, "owned_by": "opencode",
"metadata": md,
}
// Top-level OpenAI-standard fields: discovery clients (jcode, Pi, …)
// read context/reasoning at the top level of each model entry.
if md.ContextWindow > 0 {
entry["context_window"] = md.ContextWindow
entry["context_length"] = md.ContextWindow
}
if md.MaxInput > 0 {
entry["max_input"] = md.MaxInput
}
if md.MaxOutput > 0 {
entry["max_output"] = md.MaxOutput
}
if md.Reasoning {
entry["reasoning"] = true
entry["supports_reasoning"] = true
}
if md.ToolCall {
entry["tool_call"] = true
}
if md.StructuredOutput {
entry["structured_output"] = true
}
data = append(data, entry)
}
writeJSON(w, http.StatusOK, map[string]any{"object": "list", "data": data})
}