AI_MODELS_CONFIG JSON Schema for Next AI Draw.io: Complete Configuration Reference

The AI_MODELS_CONFIG JSON schema is a strictly typed configuration object defined by the TypeScript interfaces in lib/types/model-config.ts that stores AI provider credentials and model settings for 22 supported providers including OpenAI, Anthropic, and AWS Bedrock.

The AI_MODELS_CONFIG schema governs how the DayuanJiang/next-ai-draw-io repository manages connections to large language models. This schema enforces type safety across the server and client, ensuring that provider API keys, model identifiers, and validation states conform to the expected structure defined in the source code.

JSON Schema Structure

The complete schema follows the TypeScript interfaces (MultiModelConfig, ProviderConfig, and ModelConfig) defined in lib/types/model-config.ts.

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "AIMODELSCONFIG",
  "type": "object",
  "properties": {
    "version": { "type": "integer", "enum": [1] },
    "providers": {
      "type": "array",
      "items": { "$ref": "#/definitions/providerConfig" }
    },
    "selectedModelId": { "type": ["string", "null"] },
    "showUnvalidatedModels": { "type": "boolean" }
  },
  "required": ["version", "providers"],
  "definitions": {
    "providerName": {
      "type": "string",
      "enum": [
        "openai","anthropic","google","vertexai","azure","bedrock","ollama",
        "openrouter","aihubmix","deepseek","siliconflow","sglang","gateway",
        "edgeone","doubao","modelscope","glm","qwen","qiniu","kimi",
        "minimax","novita","mimo"
      ]
    },
    "modelConfig": {
      "type": "object",
      "properties": {
        "id":      { "type": "string" },
        "modelId": { "type": "string" },
        "validated":      { "type": "boolean" },
        "validationError":{ "type": "string" }
      },
      "required": ["id","modelId"]
    },
    "providerConfig": {
      "type": "object",
      "properties": {
        "id":          { "type": "string" },
        "provider":    { "$ref": "#/definitions/providerName" },
        "name":        { "type": "string" },
        "apiKey":      { "type": "string" },
        "baseUrl":     { "type": "string", "format": "uri" },
        "awsAccessKeyId":      { "type": "string" },
        "awsSecretAccessKey":  { "type": "string" },
        "awsRegion":           { "type": "string" },
        "awsSessionToken":     { "type": "string" },
        "vertexApiKey":        { "type": "string" },
        "models": {
          "type": "array",
          "items": { "$ref": "#/definitions/modelConfig" }
        },
        "validated": { "type": "boolean" }
      },
      "required": ["id","provider","apiKey","models"]
    }
  }
}

Root Properties

The root AI_MODELS_CONFIG object requires two mandatory fields while supporting optional UI state properties:

  • version: Must be set to 1 (integer) – the current schema version enforced by the MultiModelConfig interface.
  • providers: An array of provider objects, each following the providerConfig definition.
  • selectedModelId: String UUID of the currently selected model or null if no model is selected.
  • showUnvalidatedModels: Boolean flag that, when true, displays models that haven't passed validation in the UI.

Provider Configuration

Each entry in the providers array follows the ProviderConfig interface. Required fields include:

  • id: Unique string identifier for the provider instance.
  • provider: Provider name from the supported enum (22 values including "openai", "anthropic", "bedrock").
  • apiKey: Authentication key for the service (can be empty string for local providers like Ollama).
  • models: Array of model configuration objects.

Optional provider-specific fields include:

  • baseUrl: Custom endpoint URL (URI format) for API requests.
  • name: Human-readable display name for the provider.
  • awsAccessKeyId, awsSecretAccessKey, awsRegion, awsSessionToken: AWS credentials required for Bedrock integration.
  • vertexApiKey: Google Vertex AI authentication key.
  • validated: Boolean indicating whether the provider's credentials have been verified.

Model Configuration

Individual models within a provider's models array use the ModelConfig interface:

  • id: Unique string identifier for the model instance.
  • modelId: The actual model identifier (e.g., "gpt-4o", "claude-3-opus", "anthropic.claude-opus-4-8").
  • validated: Boolean indicating successful API key validation for this specific model.
  • validationError: String containing error messages if validation failed.

Supported AI Providers

The providerName enum in lib/types/model-config.ts recognizes 22 distinct providers:

  • OpenAI: openai
  • Anthropic: anthropic
  • Google: google, vertexai
  • Azure: azure
  • AWS: bedrock
  • Local/Self-hosted: ollama, sglang
  • Aggregators: openrouter, aihubmix, gateway
  • Chinese Providers: deepseek, siliconflow, edgeone, doubao, modelscope, glm, qwen, qiniu, kimi, minimax, novita, mimo

Configuration Examples

Minimal OpenAI Setup

This example configures a single OpenAI provider with one validated model:

{
  "version": 1,
  "providers": [
    {
      "id": "1698741234567-abcxyz",
      "provider": "openai",
      "apiKey": "sk-**************",
      "baseUrl": "https://api.openai.com/v1",
      "models": [
        {
          "id": "1698741240000-123def",
          "modelId": "gpt-4o",
          "validated": true
        }
      ],
      "validated": true
    }
  ],
  "selectedModelId": "1698741240000-123def",
  "showUnvalidatedModels": false
}

Multi-Provider Configuration

This example demonstrates simultaneous configuration of OpenAI, Anthropic, and AWS Bedrock:

{
  "version": 1,
  "providers": [
    {
      "id": "p1",
      "provider": "openai",
      "apiKey": "sk-OPENAI-KEY",
      "models": [
        { "id": "m1", "modelId": "gpt-4o-mini" }
      ]
    },
    {
      "id": "p2",
      "provider": "anthropic",
      "apiKey": "sk-ANTHROPIC-KEY",
      "models": [
        { "id": "m2", "modelId": "claude-sonnet-4-6" }
      ]
    },
    {
      "id": "p3",
      "provider": "bedrock",
      "awsAccessKeyId": "AKIA...",
      "awsSecretAccessKey": "...",
      "awsRegion": "us-east-1",
      "models": [
        { "id": "m3", "modelId": "anthropic.claude-opus-4-8" }
      ]
    }
  ],
  "selectedModelId": "m2",
  "showUnvalidatedModels": true
}

Implementation Files

The schema is implemented across four key files in the DayuanJiang/next-ai-draw-io repository:

  • lib/types/model-config.ts: Declares the MultiModelConfig, ProviderConfig, ModelConfig, and ProviderName TypeScript types that form the type foundation of the JSON schema.
  • lib/server-model-config.ts: Handles server-side loading, persistence, and runtime validation of the JSON configuration.
  • lib/validation-schema.ts: Contains runtime validation logic using Zod that mirrors the TypeScript interfaces for runtime safety.
  • hooks/use-model-config.ts: React hook exposing the configuration to the UI with helpers for model selection and state management.

Summary

  • The AI_MODELS_CONFIG schema requires version: 1 and a providers array containing at least one provider object.
  • Each provider must specify id, provider, apiKey, and a models array with objects containing id and modelId.
  • AWS Bedrock requires additional credential fields (awsAccessKeyId, awsSecretAccessKey, awsRegion) instead of a standard apiKey.
  • Google Vertex AI uses the vertexApiKey field for authentication.
  • Configuration validation occurs in lib/validation-schema.ts while type definitions reside in lib/types/model-config.ts.
  • The schema supports 22 AI providers ranging from OpenAI and Anthropic to regional services like Doubao and Qiniu.

Frequently Asked Questions

What is the required schema version for AI_MODELS_CONFIG?

The version field must be set to 1 as an integer. This is enforced by the MultiModelConfig interface in lib/types/model-config.ts and validated at runtime in lib/server-model-config.ts to ensure backward compatibility.

Which fields are required in a provider configuration?

Every provider object must include id (unique string), provider (enum value from the supported list), apiKey (string), and models (array of model objects). The apiKey can be an empty string for local providers like Ollama, but the field must be present to satisfy the ProviderConfig interface.

How do I configure AWS Bedrock credentials?

For AWS Bedrock providers, omit the standard apiKey field and instead provide awsAccessKeyId, awsSecretAccessKey, and awsRegion. Optionally include awsSessionToken for temporary credentials. These fields are defined in the ProviderConfig interface and processed by the server-side configuration handler.

Where does the configuration validation happen?

Runtime validation occurs in lib/validation-schema.ts using Zod schemas that mirror the TypeScript interfaces. The server-side logic in lib/server-model-config.ts invokes these validators when loading configuration files, ensuring type safety before the data reaches the React frontend via hooks/use-model-config.ts.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →