Media Job Contracts (media/contracts.ts)

claude-code-router · packages/core/src/media/contracts.ts · typescript · MIT
ai, files, integration, dev-tools, lang:typescript, tag:contracts

TypeScript interfaces and enums describing media operations, job lifecycle, artifacts, errors, and usage for AI‑generated image/video services. Reuse for consistent API contracts across media backends.

// Source: https://github.com/musistudio/claude-code-router | License: MIT | Copyright 2025 musistudio
// Provided via justclaw.it.com; keep this notice with the code.
export type MediaOperation = "image-edit" | "image-generate" | "video-generate";
export type MediaJobStatus = "canceled" | "failed" | "queued" | "running" | "succeeded";
export type ResolvedMediaBackend = "gateway-media-api" | "provider-api";

export type MediaArtifact = {
  accessToken: string;
  expiresAt: string;
  fileName: string;
  id: string;
  localPath: string;
  mimeType: string;
  sha256: string;
  sizeBytes: number;
};

export type MediaJobError = {
  code: string;
  message: string;
  retryable: boolean;
};

export type MediaUsage = {
  costUsdTicks?: number;
};

export type MediaJob = {
  artifact?: MediaArtifa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key