Skip to content

Instantly share code, notes, and snippets.

@remorses
Created October 9, 2026 10:40
Show Gist options
  • Select an option

  • Save remorses/776ab3907d24c1fe9749232f0189588a to your computer and use it in GitHub Desktop.

Select an option

Save remorses/776ab3907d24c1fe9749232f0189588a to your computer and use it in GitHub Desktop.
OpenCode V2 opencode.json JSON Schema (generated from @opencode/schema)

OpenCode V2 config JSON Schema

JSON Schema for the native V2 opencode.json(c) shape. OpenCode hosts no V2 config schema.

{
  "$schema": "https://gist.githubusercontent.com/remorses/776ab3907d24c1fe9749232f0189588a/raw/opencode-v2-config.schema.json"
}

Why

  • https://opencode.ai/config.json is the V1 schema (provider, plugin, permission, agent). Editors flag V2 keys (providers, plugins, permissions, agents) as errors.
  • The V2 site build only publishes https://opencode.ai/v2/cli.json and openapi.json (services/www/package.json generate script).
  • OpenCode's built-in skill says it directly: "The schema served from https://opencode.ai/config.json may describe V1 even though V2 configuration files include that URL."

Source

Generated with Schema.toJsonSchemaDocument(Info) from @opencode/schema/config 2.0.19 (Effect 4.0.0-rc.112). Same method OpenCode uses for cli.json (packages/cli/script/schema.ts).

References

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "OpenCode V2 config (opencode.json)",
"description": "Generated from @opencode/schema Config.Info (native V2 shape). OpenCode hosts no V2 config schema; https://opencode.ai/config.json is V1.",
"$ref": "#/$defs/Config.InfoEncoded",
"$defs": {
"Permission.Effect": {
"type": "string",
"enum": [
"allow",
"deny",
"ask"
]
},
"Permission.Rule": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"resource": {
"type": "string"
},
"effect": {
"$ref": "#/$defs/Permission.Effect"
}
},
"required": [
"action",
"resource",
"effect"
],
"additionalProperties": false
},
"Permission.Ruleset": {
"type": "array",
"items": {
"$ref": "#/$defs/Permission.Rule"
}
},
"Config.AgentEncoded": {
"type": "object",
"properties": {
"model": {
"anyOf": [
{
"type": "string",
"pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$"
},
{
"type": "object",
"properties": {
"providerID": {
"type": "string",
"pattern": "^[^/#]+$"
},
"model": {
"type": "string",
"pattern": "^[^#]+$"
},
"variant": {
"type": "string",
"pattern": "^[^#]+$"
}
},
"required": [
"providerID",
"model"
],
"additionalProperties": false
}
]
},
"request": {
"type": "object",
"properties": {
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"body": {
"type": "object"
}
},
"additionalProperties": false
},
"system": {
"type": "string"
},
"description": {
"type": "string"
},
"mode": {
"type": "string",
"enum": [
"subagent",
"primary",
"all"
]
},
"hidden": {
"type": "boolean"
},
"color": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}$"
},
"steps": {
"type": "integer",
"exclusiveMinimum": 0
},
"disabled": {
"type": "boolean"
},
"permissions": {
"$ref": "#/$defs/Permission.Ruleset"
}
},
"additionalProperties": false
},
"Config.Formatter.EntryEncoded": {
"type": "object",
"properties": {
"disabled": {
"type": "boolean"
},
"command": {
"type": "array",
"items": {
"type": "string"
}
},
"environment": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"extensions": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"Config.LSP.ServerEncoded": {
"type": "object",
"properties": {
"command": {
"type": "array",
"items": {
"type": "string"
}
},
"extensions": {
"type": "array",
"items": {
"type": "string"
}
},
"disabled": {
"type": "boolean"
},
"env": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"initialization": {
"type": "object"
}
},
"required": [
"command"
],
"additionalProperties": false
},
"Mcp.Protocol": {
"type": "string",
"enum": [
"legacy",
"auto",
"2026-07-28"
],
"description": "MCP protocol negotiation. \"legacy\" (default) opens with the initialize handshake and speaks protocol revisions up to 2025-11-25. \"auto\" probes for the 2026-07-28 revision and falls back to legacy when the server does not support it. \"2026-07-28\" requires that revision and fails otherwise."
},
"Mcp.LocalConfigEncoded": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"local"
]
},
"command": {
"type": "array",
"items": {
"type": "string"
}
},
"cwd": {
"type": "string"
},
"environment": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"disabled": {
"type": "boolean"
},
"codemode": {
"type": "boolean"
},
"timeout": {
"type": "object",
"properties": {
"startup": {
"type": "integer",
"exclusiveMinimum": 0
},
"catalog": {
"type": "integer",
"exclusiveMinimum": 0
},
"execution": {
"type": "integer",
"exclusiveMinimum": 0
}
},
"additionalProperties": false
},
"protocol": {
"$ref": "#/$defs/Mcp.Protocol"
}
},
"required": [
"type",
"command"
],
"additionalProperties": false
},
"Mcp.OAuthConfigEncoded": {
"type": "object",
"properties": {
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
},
"scope": {
"type": "string"
},
"callback_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"redirect_uri": {
"type": "string"
},
"auth_server_metadata_url": {
"type": "string"
}
},
"additionalProperties": false
},
"Mcp.RemoteConfigEncoded": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"remote"
]
},
"url": {
"type": "string"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"oauth": {
"anyOf": [
{
"$ref": "#/$defs/Mcp.OAuthConfigEncoded"
},
{
"type": "boolean",
"enum": [
false
]
}
]
},
"disabled": {
"type": "boolean"
},
"codemode": {
"type": "boolean"
},
"timeout": {
"type": "object",
"properties": {
"startup": {
"type": "integer",
"exclusiveMinimum": 0
},
"catalog": {
"type": "integer",
"exclusiveMinimum": 0
},
"execution": {
"type": "integer",
"exclusiveMinimum": 0
}
},
"additionalProperties": false
},
"protocol": {
"$ref": "#/$defs/Mcp.Protocol"
}
},
"required": [
"type",
"url"
],
"additionalProperties": false
},
"Config.CommandEncoded": {
"type": "object",
"properties": {
"template": {
"type": "string"
},
"description": {
"type": "string"
},
"agent": {
"type": "string"
},
"model": {
"anyOf": [
{
"type": "string",
"pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$"
},
{
"type": "object",
"properties": {
"providerID": {
"type": "string",
"pattern": "^[^/#]+$"
},
"model": {
"type": "string",
"pattern": "^[^#]+$"
},
"variant": {
"type": "string",
"pattern": "^[^#]+$"
}
},
"required": [
"providerID",
"model"
],
"additionalProperties": false
}
]
},
"subagent": {
"type": "boolean"
},
"subtask": {
"type": "boolean",
"description": "Deprecated alias for subagent."
}
},
"required": [
"template"
],
"additionalProperties": false
},
"Config.Reference.GitEncoded": {
"type": "object",
"properties": {
"repository": {
"type": "string"
},
"branch": {
"type": "string"
},
"description": {
"type": "string"
},
"hidden": {
"type": "boolean"
}
},
"required": [
"repository"
],
"additionalProperties": false
},
"Config.Reference.LocalEncoded": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"description": {
"type": "string"
},
"hidden": {
"type": "boolean"
}
},
"required": [
"path"
],
"additionalProperties": false
},
"ConfigWebSearch.InfoEncoded": {
"type": "object",
"properties": {
"provider": {
"anyOf": [
{
"type": "string",
"enum": [
"random"
],
"description": "Reuse a randomly selected provider until it is rate limited, then switch to another available provider."
},
{
"type": "string"
}
]
}
},
"required": [
"provider"
],
"additionalProperties": false
},
"Config.Plugin.EntryEncoded": {
"type": "object",
"properties": {
"package": {
"type": "string"
},
"options": {
"type": "object"
}
},
"required": [
"package"
],
"additionalProperties": false
},
"Config.Worktree": {
"type": "object",
"properties": {
"directory": {
"type": "string"
}
},
"required": [
"directory"
],
"additionalProperties": false
},
"Config.WarmingEncoded": {
"type": "object",
"properties": {
"prompt": {
"type": "string"
},
"interval": {
"type": "string"
},
"duration": {
"type": "string"
}
},
"additionalProperties": false
},
"Provider.Compaction": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"summary"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"native"
]
}
},
"required": [
"type"
],
"additionalProperties": false
}
]
},
"Provider.Transport": {
"type": "string",
"enum": [
"http",
"websocket"
]
},
"Config.Provider.Settings": {
"type": "object",
"properties": {
"timeout": {
"anyOf": [
{
"type": "number"
},
{
"type": "boolean",
"enum": [
false
]
}
]
},
"chunkTimeout": {
"type": "number"
},
"compaction": {
"$ref": "#/$defs/Provider.Compaction"
},
"transport": {
"$ref": "#/$defs/Provider.Transport"
}
},
"allOf": [
{
"type": "object",
"additionalProperties": {
"anyOf": [
{},
{
"type": "null"
}
]
}
}
]
},
"Model.ReasoningField": {
"anyOf": [
{
"type": "string",
"enum": [
"reasoning",
"reasoning_content",
"reasoning_text"
]
},
{
"type": "string"
}
]
},
"Model.MaxTokensField": {
"type": "string",
"enum": [
"max_completion_tokens",
"max_tokens"
]
},
"Model.Compatibility": {
"type": "object",
"properties": {
"reasoningField": {
"$ref": "#/$defs/Model.ReasoningField"
},
"requireReasoning": {
"type": "boolean"
},
"maxTokensField": {
"$ref": "#/$defs/Model.MaxTokensField"
},
"requireFinishReason": {
"type": "boolean"
},
"requireAssistantAfterTool": {
"type": "boolean"
},
"supportsPromptCacheKey": {
"type": "boolean"
}
},
"additionalProperties": false
},
"Config.Model.Settings": {
"type": "object",
"properties": {
"compaction": {
"$ref": "#/$defs/Provider.Compaction"
}
},
"allOf": [
{
"type": "object",
"additionalProperties": {
"anyOf": [
{},
{
"type": "null"
}
]
}
}
]
},
"Model.Capabilities": {
"type": "object",
"properties": {
"tools": {
"type": "boolean"
},
"input": {
"type": "array",
"items": {
"type": "string"
}
},
"output": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"tools",
"input",
"output"
],
"additionalProperties": false
},
"Money.USDPerMillionTokens": {
"type": "number"
},
"Config.Model.CostEncoded": {
"type": "object",
"properties": {
"tier": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"context"
]
},
"size": {
"type": "integer"
}
},
"required": [
"type",
"size"
],
"additionalProperties": false
},
"input": {
"$ref": "#/$defs/Money.USDPerMillionTokens"
},
"output": {
"$ref": "#/$defs/Money.USDPerMillionTokens"
},
"cache": {
"type": "object",
"properties": {
"read": {
"$ref": "#/$defs/Money.USDPerMillionTokens"
},
"write": {
"$ref": "#/$defs/Money.USDPerMillionTokens"
}
},
"additionalProperties": false
}
},
"required": [
"input",
"output"
],
"additionalProperties": false
},
"Config.ModelEncoded": {
"type": "object",
"properties": {
"modelID": {
"type": "string"
},
"family": {
"type": "string"
},
"name": {
"type": "string"
},
"compatibility": {
"$ref": "#/$defs/Model.Compatibility"
},
"package": {
"type": "string"
},
"settings": {
"$ref": "#/$defs/Config.Model.Settings"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"body": {
"type": "object"
},
"capabilities": {
"$ref": "#/$defs/Model.Capabilities"
},
"variants": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"settings": {
"$ref": "#/$defs/Config.Model.Settings"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"body": {
"type": "object"
}
},
"required": [
"id"
],
"additionalProperties": false
}
},
"cost": {
"anyOf": [
{
"$ref": "#/$defs/Config.Model.CostEncoded"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/Config.Model.CostEncoded"
}
}
]
},
"disabled": {
"type": "boolean"
},
"limit": {
"type": "object",
"properties": {
"context": {
"type": "integer"
},
"input": {
"type": "integer"
},
"output": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"Config.ProviderEncoded": {
"type": "object",
"properties": {
"canonical": {
"type": "string"
},
"name": {
"type": "string"
},
"env": {
"type": "array",
"items": {
"type": "string"
}
},
"package": {
"type": "string"
},
"settings": {
"$ref": "#/$defs/Config.Provider.Settings"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"body": {
"type": "object"
},
"models": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/Config.ModelEncoded"
}
}
},
"additionalProperties": false
},
"Config.InfoEncoded": {
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"shell": {
"type": "string"
},
"model": {
"anyOf": [
{
"type": "string",
"pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$"
},
{
"type": "object",
"properties": {
"providerID": {
"type": "string",
"pattern": "^[^/#]+$"
},
"model": {
"type": "string",
"pattern": "^[^#]+$"
},
"variant": {
"type": "string",
"pattern": "^[^#]+$"
}
},
"required": [
"providerID",
"model"
],
"additionalProperties": false
}
]
},
"default_agent": {
"type": "string"
},
"update": {
"type": "string",
"enum": [
"disable",
"notify",
"auto"
]
},
"share": {
"type": "string",
"enum": [
"manual",
"auto",
"disabled"
]
},
"enterprise": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"additionalProperties": false
},
"username": {
"type": "string"
},
"permissions": {
"$ref": "#/$defs/Permission.Ruleset"
},
"agents": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/Config.AgentEncoded"
}
},
"snapshots": {
"type": "boolean"
},
"watcher": {
"type": "object",
"properties": {
"ignore": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"formatter": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/Config.Formatter.EntryEncoded"
}
}
]
},
"lsp": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "object",
"properties": {
"disabled": {
"type": "boolean",
"enum": [
true
]
}
},
"required": [
"disabled"
],
"additionalProperties": false
},
{
"$ref": "#/$defs/Config.LSP.ServerEncoded"
}
]
}
}
]
},
"media": {
"type": "object",
"properties": {
"image": {
"type": "object",
"properties": {
"auto_resize": {
"type": "boolean"
},
"max_width": {
"type": "integer",
"exclusiveMinimum": 0
},
"max_height": {
"type": "integer",
"exclusiveMinimum": 0
},
"max_base64_bytes": {
"type": "integer",
"exclusiveMinimum": 0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"tool_output": {
"type": "object",
"properties": {
"max_lines": {
"type": "integer",
"exclusiveMinimum": 0
},
"max_bytes": {
"type": "integer",
"exclusiveMinimum": 0
}
},
"additionalProperties": false
},
"mcp": {
"type": "object",
"properties": {
"timeout": {
"type": "object",
"properties": {
"startup": {
"type": "integer",
"exclusiveMinimum": 0
},
"catalog": {
"type": "integer",
"exclusiveMinimum": 0
},
"execution": {
"type": "integer",
"exclusiveMinimum": 0
}
},
"additionalProperties": false
},
"servers": {
"type": "object",
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/Mcp.LocalConfigEncoded"
},
{
"$ref": "#/$defs/Mcp.RemoteConfigEncoded"
}
]
}
}
},
"additionalProperties": false
},
"compaction": {
"type": "object",
"properties": {
"auto": {
"type": "boolean"
},
"keep": {
"type": "object",
"properties": {
"tokens": {
"type": "integer",
"minimum": 0
}
},
"additionalProperties": false
},
"buffer": {
"type": "integer",
"minimum": 0
}
},
"additionalProperties": false
},
"skills": {
"type": "array",
"items": {
"type": "string"
}
},
"commands": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/Config.CommandEncoded"
}
},
"instructions": {
"type": "array",
"items": {
"type": "string"
}
},
"references": {
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/$defs/Config.Reference.GitEncoded"
},
{
"$ref": "#/$defs/Config.Reference.LocalEncoded"
}
]
}
},
"websearch": {
"anyOf": [
{
"type": "boolean",
"enum": [
false
]
},
{
"$ref": "#/$defs/ConfigWebSearch.InfoEncoded"
}
]
},
"plugins": {
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/$defs/Config.Plugin.EntryEncoded"
}
]
}
},
"worktree": {
"$ref": "#/$defs/Config.Worktree"
},
"warming": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/$defs/Config.WarmingEncoded"
}
]
},
"providers": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/Config.ProviderEncoded"
}
},
"experimental": {
"type": "object",
"properties": {
"portable_shell_scanner": {
"type": "boolean"
},
"subagent_depth": {
"type": "integer",
"minimum": 0
},
"policies": {
"type": "array",
"items": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"provider.use",
"permission"
]
},
"resource": {
"type": "string"
},
"effect": {
"type": "string",
"enum": [
"allow",
"deny"
]
}
},
"required": [
"action",
"resource",
"effect"
],
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment