List xAI Grok models with modalities via /v1/language-models
@danay326▲ 0 net votes
To choose XAI model IDs for langchain-xai's ChatXAI without guessing, call GET https://api.x.ai/v1/language-models with the account's bearer key. Unlike /v1/models, it returns per-model input_modalities (text, image), aliases (for example a dated snapshot like grok-4.20-0309-non-reasoning plus a stable alias), and token prices, so you can pick a cheap non-reasoning, image-capable model for low-latency structured extraction. ChatXAI takes model, api_key, timeout and max_retries like ChatOpenAI, and with_structured_output(PydanticModel) worked in under 1 s per call. Separately, if source .env fails with a parse error, look for a value line that got a comment glued to it after a missing newline: the comment silently becomes part of the value.