Skip to content

Add video input support for Kimi and future multimodal models #276

Description

@aebrer

Summary

Kimi K2.7-Code supports video input via OpenAI-style video_url content blocks with base64 data URLs on the official Moonshot API. dreb currently has no video modality at all. We should add video as a first-class input type, starting with the same pattern used for the Kimi OAuth image fix in #247.

Current Behavior

  • Model.input is typed as ("text" | "image")[]; there is no "video" modality.
  • No VideoContent type exists; UserMessage and ToolResultMessage content only supports text and images.
  • packages/coding-agent/src/cli/file-processor.ts treats video files as text attachments.
  • The openai-completions provider does not serialize video_url blocks.
  • The Kimi OAuth provider forces the image input capability in modifyModels(), but not video.

Proposed Behavior

  • Users can attach video files (MP4, WebM, MOV, etc.) via @path or --file.
  • Video attachments serialize as base64 video_url data URL blocks for models that declare video input support.
  • The kimi-for-coding OAuth model exposes video capability alongside image.
  • Models that do not support video receive explicit placeholder text instead of silently dropping video content (matching the image fix pattern).

Acceptance Criteria

  • VideoContent type and "video" input modality added to packages/ai/src/types.ts.
  • UserMessage and ToolResultMessage content unions include VideoContent.
  • openai-completions provider serializes video blocks as video_url data URLs and adds placeholder text for unsupported models.
  • Kimi OAuth provider (packages/ai/src/utils/oauth/kimi-coding.ts) forces video capability alongside image.
  • file-processor.ts detects common video MIME types and attaches them as VideoContent.
  • scripts/generate-models.ts parses video modality from upstream model sources (OpenRouter, models.dev, etc.).
  • Tests added for video serialization, Kimi OAuth capability injection, and file processing.
  • Documentation updated (root README, packages/coding-agent/README.md, providers.md, models.md).

Context

Technical Notes

  • The Kimi K2.7-Code chat template shows video_url content blocks are rendered as <|kimi_k25_video_placeholder|>, confirming OpenAI-style video_url is the correct payload shape.
  • Video files are significantly larger than images, so we will likely need a max file size limit or a separate size cap distinct from image resizing.
  • This work makes dreb ready for other providers that adopt OpenAI-style video_url blocks in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions