{
  "id": "xai",
  "name": "xAI (Grok)",
  "description": "xAI provider for Grok models, Grok web and X search, code execution, speech, and media generation.",
  "categories": [
    "models"
  ],
  "capabilityCatalogEntry": "./capability-catalog.js",
  "doctorContract": {
    "configRepair": true
  },
  "activation": {
    "onStartup": false
  },
  "enabledByDefault": true,
  "providers": [
    "xai"
  ],
  "providerAuthAliases": {
    "x-ai": "xai"
  },
  "providerCatalogEntry": "./provider-discovery.js",
  "modelIdNormalization": {
    "providers": {
      "xai": {
        "aliases": {
          "grok-4.3-latest": "grok-4.3",
          "grok-4.5-latest": "grok-4.5",
          "grok-4.7-latest": "grok-4.7",
          "grok-build-latest": "grok-4.5"
        }
      }
    }
  },
  "providerEndpoints": [
    {
      "endpointClass": "xai-native",
      "hosts": [
        "api.x.ai"
      ]
    },
    {
      "endpointClass": "custom",
      "baseUrls": [
        "https://cli-chat-proxy.grok.com/v1"
      ]
    }
  ],
  "providerRequest": {
    "providers": {
      "xai": {
        "family": "xai"
      }
    }
  },
  "modelCatalog": {
    "providers": {
      "xai": {
        "baseUrl": "https://api.x.ai/v1",
        "api": "openai-responses",
        "models": [
          {
            "id": "grok-4.7",
            "name": "Grok 4.7",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 2,
              "output": 6,
              "cacheRead": 0.5,
              "cacheWrite": 0
            },
            "contextWindow": 500000,
            "maxTokens": 64000
          },
          {
            "id": "grok-4.6",
            "name": "Grok 4.6",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 2,
              "output": 6,
              "cacheRead": 0.5,
              "cacheWrite": 0
            },
            "contextWindow": 500000,
            "maxTokens": 64000
          },
          {
            "id": "grok-4.5",
            "name": "Grok 4.5",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 2,
              "output": 6,
              "cacheRead": 0.3,
              "cacheWrite": 0
            },
            "contextWindow": 500000,
            "maxTokens": 64000
          },
          {
            "id": "grok-build-0.1",
            "name": "Grok Build 0.1",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 1,
              "output": 2,
              "cacheRead": 0.2,
              "cacheWrite": 0
            },
            "contextWindow": 256000,
            "maxTokens": 64000
          },
          {
            "id": "grok-4.3",
            "name": "Grok 4.3",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 1.25,
              "output": 2.5,
              "cacheRead": 0.2,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 64000
          },
          {
            "id": "grok-4.20-0309-reasoning",
            "name": "Grok 4.20 0309 (Reasoning)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 1.25,
              "output": 2.5,
              "cacheRead": 0.2,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 30000
          },
          {
            "id": "grok-4.20-0309-non-reasoning",
            "name": "Grok 4.20 0309 (Non-Reasoning)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 1.25,
              "output": 2.5,
              "cacheRead": 0.2,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 30000
          }
        ]
      }
    },
    "aliases": {
      "x-ai": {
        "provider": "xai"
      }
    },
    "discovery": {
      "xai": "refreshable"
    },
    "suppressions": [
      {
        "provider": "xai",
        "model": "auto",
        "reason": "The xAI auto selector has retired; use a concrete model.",
        "retirement": {
          "replacedBy": "grok-4.7"
        },
        "when": {
          "baseUrlHosts": [
            "cli-chat-proxy.grok.com",
            "api.x.ai"
          ]
        }
      },
      {
        "provider": "xai",
        "model": "grok-4.20-multi-agent-0309",
        "reason": "OpenClaw does not currently support xAI multi-agent models; choose another xAI model. See https://docs.openclaw.ai/providers/xai."
      },
      {
        "provider": "xai",
        "model": "grok-4.20-multi-agent",
        "reason": "OpenClaw does not currently support xAI multi-agent models; choose another xAI model. See https://docs.openclaw.ai/providers/xai."
      },
      {
        "provider": "xai",
        "model": "grok-4.20-multi-agent-latest",
        "reason": "OpenClaw does not currently support xAI multi-agent models; choose another xAI model. See https://docs.openclaw.ai/providers/xai."
      },
      {
        "provider": "xai",
        "model": "grok-4.20-multi-agent-beta-latest",
        "reason": "OpenClaw does not currently support xAI multi-agent models; choose another xAI model. See https://docs.openclaw.ai/providers/xai."
      },
      {
        "provider": "xai",
        "model": "grok-4.20-multi-agent-experimental-beta-0304",
        "reason": "OpenClaw does not currently support xAI multi-agent models; choose another xAI model. See https://docs.openclaw.ai/providers/xai."
      },
      {
        "provider": "xai",
        "model": "grok-4.20-multi-agent-experimental-beta-latest",
        "reason": "OpenClaw does not currently support xAI multi-agent models; choose another xAI model. See https://docs.openclaw.ai/providers/xai."
      },
      {
        "provider": "xai",
        "model": "grok-4.20-multi-agent-beta-0309",
        "reason": "OpenClaw does not currently support xAI multi-agent models; choose another xAI model. See https://docs.openclaw.ai/providers/xai."
      }
    ]
  },
  "syntheticAuthRefs": [
    "xai"
  ],
  "setup": {
    "providers": [
      {
        "id": "xai",
        "envVars": [
          "XAI_API_KEY"
        ]
      }
    ]
  },
  "providerAuthChoices": [
    {
      "provider": "xai",
      "method": "api-key",
      "personalAccount": true,
      "choiceId": "xai-api-key",
      "appGuidedSecret": true,
      "choiceLabel": "xAI API key",
      "groupId": "xai",
      "groupLabel": "xAI (Grok)",
      "groupHint": "API key or OAuth",
      "onboardingFeatured": true,
      "optionKey": "xaiApiKey",
      "cliFlag": "--xai-api-key",
      "cliOption": "--xai-api-key <key>",
      "cliDescription": "xAI API key"
    },
    {
      "provider": "xai",
      "method": "oauth",
      "personalAccount": true,
      "choiceId": "xai-oauth",
      "appGuidedAuth": "device-code",
      "credentialOnly": true,
      "channelLogin": {},
      "choiceLabel": "xAI OAuth",
      "choiceHint": "Remote-friendly browser sign-in without a localhost callback",
      "groupId": "xai",
      "groupLabel": "xAI (Grok)",
      "groupHint": "API key or OAuth",
      "onboardingFeatured": true
    },
    {
      "provider": "xai",
      "method": "device-code",
      "choiceId": "xai-device-code",
      "appGuidedAuth": "device-code",
      "choiceLabel": "xAI device code",
      "choiceHint": "Compatibility alias for xAI OAuth device-code sign-in",
      "assistantVisibility": "manual-only",
      "groupId": "xai",
      "groupLabel": "xAI (Grok)",
      "groupHint": "API key or OAuth"
    }
  ],
  "uiHints": {
    "webSearch.apiKey": {
      "label": "Grok Search API Key",
      "help": "Optional xAI API key for Grok web search; xAI OAuth or XAI_API_KEY can satisfy it.",
      "sensitive": true
    },
    "webSearch.model": {
      "label": "Grok Search Model",
      "help": "Grok model override for web search."
    },
    "webSearch.baseUrl": {
      "label": "Grok Search Base URL",
      "help": "Optional xAI Responses API base URL for Grok web_search and x_search fallbacks."
    },
    "webSearch.inlineCitations": {
      "label": "Inline Citations",
      "help": "Include inline markdown citations in Grok responses."
    },
    "codeExecution.enabled": {
      "label": "Enable Code Execution",
      "help": "Expose code_execution on active xAI models; true opts in when the active provider is known non-xAI, false disables, and missing provider fails closed. Requires xAI auth; xAI bills $5/1,000 calls plus model tokens."
    },
    "xSearch.enabled": {
      "label": "Enable X Search",
      "help": "Expose x_search on active xAI models; true opts in when the active provider is known non-xAI, false disables, and missing provider fails closed. Requires xAI auth; xAI bills $5/1,000 calls plus model tokens."
    },
    "xSearch.model": {
      "label": "X Search Model",
      "help": "xAI model override for x_search."
    },
    "xSearch.baseUrl": {
      "label": "X Search Base URL",
      "help": "Optional xAI Responses API base URL for x_search requests."
    },
    "xSearch.inlineCitations": {
      "label": "X Search Inline Citations",
      "help": "Keep inline markdown citations from xAI in x_search responses when available."
    },
    "xSearch.maxTurns": {
      "label": "X Search Max Turns",
      "help": "Optional max internal tool turns xAI may use per x_search request."
    },
    "xSearch.timeoutSeconds": {
      "label": "X Search Timeout",
      "help": "Timeout in seconds for x_search requests."
    },
    "xSearch.cacheTtlMinutes": {
      "label": "X Search Cache TTL",
      "help": "Cache TTL in minutes for x_search results."
    },
    "codeExecution.model": {
      "label": "Code Execution Model",
      "help": "xAI model override for code_execution."
    },
    "codeExecution.maxTurns": {
      "label": "Code Execution Max Turns",
      "help": "Optional max internal tool turns xAI may use for code_execution."
    },
    "codeExecution.timeoutSeconds": {
      "label": "Code Execution Timeout",
      "help": "Timeout in seconds for code_execution requests."
    }
  },
  "contracts": {
    "webSearchProviders": [
      "grok"
    ],
    "usageProviders": [
      "xai"
    ],
    "videoGenerationProviders": [
      "xai"
    ],
    "mediaUnderstandingProviders": [
      "xai"
    ],
    "speechProviders": [
      "xai"
    ],
    "realtimeTranscriptionProviders": [
      "xai"
    ],
    "realtimeVoiceProviders": [
      "xai",
      "grok-voice",
      "xai-realtime-voice"
    ],
    "imageGenerationProviders": [
      "xai"
    ],
    "tools": [
      "code_execution",
      "x_search"
    ]
  },
  "mediaUnderstandingProviderMetadata": {
    "xai": {
      "capabilities": [
        "audio"
      ],
      "autoPriority": {
        "audio": 25
      }
    }
  },
  "toolMetadata": {
    "code_execution": {
      "authSignals": [
        {
          "provider": "xai"
        }
      ],
      "configSignals": [
        {
          "rootPath": "plugins.entries.xai.config",
          "overlayPath": "webSearch",
          "required": [
            "apiKey"
          ]
        }
      ]
    },
    "x_search": {
      "replaySafe": true,
      "authSignals": [
        {
          "provider": "xai"
        }
      ],
      "configSignals": [
        {
          "rootPath": "plugins.entries.xai.config",
          "overlayPath": "webSearch",
          "required": [
            "apiKey"
          ]
        }
      ]
    }
  },
  "configGroups": [
    {
      "id": "web-search",
      "title": "Web search",
      "order": 10,
      "properties": [
        "webSearch"
      ]
    },
    {
      "id": "x-search",
      "title": "X search",
      "order": 20,
      "properties": [
        "xSearch"
      ]
    },
    {
      "id": "code-execution",
      "title": "Code execution",
      "order": 30,
      "properties": [
        "codeExecution"
      ]
    }
  ],
  "configSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "webSearch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "apiKey": {
            "type": [
              "string",
              "object"
            ]
          },
          "model": {
            "type": "string"
          },
          "baseUrl": {
            "type": "string"
          },
          "inlineCitations": {
            "type": "boolean"
          }
        }
      },
      "xSearch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          },
          "baseUrl": {
            "type": "string"
          },
          "inlineCitations": {
            "type": "boolean"
          },
          "maxTurns": {
            "type": "number"
          },
          "timeoutSeconds": {
            "type": "number"
          },
          "cacheTtlMinutes": {
            "type": "number"
          }
        }
      },
      "codeExecution": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          },
          "maxTurns": {
            "type": "number"
          },
          "timeoutSeconds": {
            "type": "number"
          }
        }
      }
    }
  }
}
