Make Codex and Claude Code subscriptions go further: a local model router that gives routine agent work to economical models and keeps your strongest model for the hard parts.
Rust ai-agentsai-gatewayclaude-codecodexcoding-agentcost-optimizationdeepseekllm-gatewayllm-routerlocal-firstmodel-routingrusttask-routingtauri
{
"$defs": {
"error": {
"additionalProperties": false,
"properties": {
"category": {
"enum": [
"usage",
"conflict",
"authorization",
"not_found",
"unavailable",
"action_required",
"recovery",
"internal"
]
},
"code": {
"pattern": "^[A-Z][A-Z0-9_]+$",
"type": "string"
},
"details_schema": {
"minLength": 1,
"type": "string"
},
"message_key": {
"minLength": 1,
"type": "string"
},
"model_budget_conflict": {
"$ref": "#/$defs/model_budget_conflict"
},
"operation_id": {
"minLength": 1,
"type": "string"
},
"retryable": {
"type": "boolean"
}
},
"required": [
"code",
"category",
"message_key",
"retryable",
"details_schema"
],
"type": "object"
},
"model_budget_blocker": {
"additionalProperties": false,
"allOf": [
{
"else": {
"properties": {
"proposed": {
"type": "null"
}
}
},
"if": {
"properties": {
"reason": {
"const": "capacity_reduced"
}
}
},
"then": {
"properties": {
"proposed": {
"$ref": "#/$defs/model_token_budget"
}
}
}
}
],
"properties": {
"agent_kind": {
"enum": [
"qoder",
"pi",
"deepseek_harness",
"opencode"
]
},
"context_id": {
"pattern": "^agent-context/[A-Za-z0-9/_:-]{1,242}$",
"type": "string"
},
"declared": {
"$ref": "#/$defs/model_token_budget"
},
"model_alias": {
"pattern": "^(hiroute/[0-9a-f]{16}|[a-z0-9][a-z0-9._-]{0,63})$",
"type": "string"
},
"plan_id": {
"maxLength": 256,
"minLength": 1,
"type": "string"
},
"proposed": {
"oneOf": [
{
"$ref": "#/$defs/model_token_budget"
},
{
"type": "null"
}
]
},
"reason": {
"enum": [
"capacity_reduced",
"plan_missing",
"budget_unavailable"
]
}
},
"required": [
"agent_kind",
"context_id",
"plan_id",
"model_alias",
"reason",
"declared",
"proposed"
],
"type": "object"
},
"model_budget_conflict": {
"additionalProperties": false,
"properties": {
"blockers": {
"items": {
"$ref": "#/$defs/model_budget_blocker"
},
"minItems": 1,
"type": "array"
},
"schema": {
"const": "hiroute.agent-model-budget-conflict/v1"
}
},
"required": [
"schema",
"blockers"
],
"type": "object"
},
"model_token_budget": {
"additionalProperties": false,
"properties": {
"context_window_tokens": {
"minimum": 1,
"type": "integer"
},
"max_output_tokens": {
"minimum": 1,
"type": "integer"
}
},
"required": [
"context_window_tokens",
"max_output_tokens"
],
"type": "object"
},
"next_action": {
"additionalProperties": false,
"properties": {
"command_id": {
"minLength": 1,
"type": "string"
},
"input": {
"type": "object"
},
"reason_code": {
"pattern": "^[A-Z][A-Z0-9_]+$",
"type": "string"
}
},
"required": [
"command_id",
"input",
"reason_code"
],
"type": "object"
},
"operation": {
"additionalProperties": false,
"properties": {
"cancellable": {
"type": "boolean"
},
"operation_id": {
"minLength": 1,
"type": "string"
},
"sequence": {
"minimum": 0,
"type": "integer"
},
"state": {
"minLength": 1,
"type": "string"
}
},
"required": [
"operation_id",
"state",
"sequence",
"cancellable"
],
"type": "object"
},
"schema_version": {
"additionalProperties": false,
"properties": {
"major": {
"const": 2
},
"minor": {
"minimum": 0,
"type": "integer"
}
},
"required": [
"major",
"minor"
],
"type": "object"
},
"warning": {
"additionalProperties": false,
"properties": {
"code": {
"minLength": 1,
"type": "string"
},
"details_schema": {
"minLength": 1,
"type": "string"
}
},
"required": [
"code",
"details_schema"
],
"type": "object"
}
},
"$id": "hiroute://contracts/cli/machine-envelope.v2.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"data": true,
"error": {
"$ref": "#/$defs/error"
},
"next_actions": {
"items": {
"$ref": "#/$defs/next_action"
},
"type": "array"
},
"operation": {
"$ref": "#/$defs/operation"
},
"request_id": {
"minLength": 1,
"type": "string"
},
"schema_version": {
"$ref": "#/$defs/schema_version"
},
"status": {
"enum": [
"succeeded",
"accepted",
"usage_error",
"conflict",
"denied",
"not_found",
"unavailable",
"action_required",
"needs_attention",
"internal_error"
]
},
"warnings": {
"items": {
"$ref": "#/$defs/warning"
},
"type": "array"
}
},
"required": [
"schema_version",
"status",
"warnings",
"next_actions"
],
"title": "HiRoute machine envelope v2",
"type": "object"
}