analysis
Media analyzer
Generate an analysis of attached media (images, a video, or an audio clip) and transform the extracted details into a prompt. Includes analysis model selection, prompt length selection (terse, concise and detailed), and automatic media type detection.
Add media to convert to prompt
Code snippet
The bare minimum is a drop zone for an image, video or audio clip that returns a generation-ready prompt.
For the stylesheets and the server route that holds your API keys, see Develop.
import { useState } from "react";import { MediaAnalyzer, MEDIA_ANALYSIS_PROMPT_LENGTHS, useMediaAnalyzer, type MediaAnalysisPromptLength, type MediaAnalyzerAttachment,} from "@chai-ui/react";
export function Analyze() { const [attachments, setAttachments] = useState<MediaAnalyzerAttachment[]>([]); const [modelId, setModelId] = useState<string | null>(null); const [autoSelectModel, setAutoSelectModel] = useState(false); const [promptLength, setPromptLength] = useState<MediaAnalysisPromptLength | null>(null); const { submit, analyzing, error, prompt } = useMediaAnalyzer();
return ( <> <MediaAnalyzer attachments={attachments} onAttachmentsChange={setAttachments} modelId={modelId} onModelChange={setModelId} autoSelectModel={autoSelectModel} onAutoSelectModelChange={setAutoSelectModel} promptLength={promptLength} onPromptLengthChange={setPromptLength} promptLengthOptions={MEDIA_ANALYSIS_PROMPT_LENGTHS} onSubmit={submit} submitting={analyzing} submitError={error} /> {prompt && <p>{prompt}</p>} </> );}Add more
| Feature | Props | Notes |
|---|---|---|
| Real analysis | <ChaiProvider> | Around your app. Without it, a mock model answers |
| Your own models | modelsByKind | Without it, Chai's suggested models for each media kind |
Preview controls
Reaches the image limit, so the drop zone shows "Maximum images added", without dropping 5 files by hand. Replaces what's attached.
Video and audio take one file each, so dropping another replaces this one. Replaces what's attached.
Make every submit fail, to preview the retry state on demand instead of wiring a real failing engine.
Suggested models
The Model menu's lists when you pass no modelsByKind, checked against OpenRouter.
Image
- Claude Opus 5standard
- GPT-5.2standard
- Gemini 3.5 Flashfast
- Llama 4 Maverickstandard
- Grok 4.5standard
Video
- Gemini 3.8 Flashfast
- Gemini 3.5 Flashfast
- Nova 2 Litefast
- Seed 2.0 Litefast
- Kimi K3standard
Audio
- Gemini 3.8 Flashfast
- GPT Audiostandard
- Voxtral Small 24Bstandard
- MiMo V2.5standard