@miraiclip/assistant
v0.6.0
Published
An AI editing assistant for Miraiclip: a vendor-neutral ChatModel contract (OpenAI, Anthropic, Google Gemini and any OpenAI-compatible provider; bring-your-own-key), an agent loop that edits a forked project and lands each request as one undo step, high-l
Maintainers
Readme
@miraiclip/assistant
An AI editing assistant for Miraiclip editors. The user asks in plain words; the project changes as one undo step.
- Any model, any provider: one small
ChatModelcontract with native adapters for OpenAI, Anthropic and Google Gemini, and one factory for the rest —createChatModel({ provider, apiKey, model })covers OpenRouter, Groq, Mistral, DeepSeek, xAI, Together, Ollama, LM Studio and any OpenAI-compatible server. Live model lists (listModels), several providers behind one model (routedChatModel, "provider/model" ids), and every configured key from env in one call (chatModelsFromEnv). - Bring your own key:
createChatHandler(model, { userKeys: true })lets each user call with their own provider key, per request, never stored. - Safe edits: the agent works on a copy of the project; when the request finishes, its commands replay onto the real project in one transaction. Failed or canceled requests leave nothing behind. Review mode waits for
turn.apply(). - Editing tools:
get_state,get_command_schema,apply_commands,add_transition(cuts, spare-footage aware),animate_clip(in / loop / out presets), plusdefineToolandtoolsFromDefinitionsfor your own (e.g.@miraiclip/audio-sources). - Keys stay on the server:
createChatHandler(Fetch API) on your backend,remoteChatModelin the browser.
import { createAssistant, createChatModel } from "@miraiclip/assistant";
const model = createChatModel({ provider: "anthropic", apiKey, model: "claude-sonnet-5-5" }); // or "openai", "gemini", "openrouter", "ollama", …
const assistant = createAssistant({ model });
const turn = await assistant.run(project, "add dissolves between the clips and make the title pop in");
turn.reply; // what the model says it did
turn.changes; // ["Added crossDissolve at 10s (0.6s)", …]Docs: https://docs.miraiclip.com/ai/assistant · models and keys: https://docs.miraiclip.com/ai/models
MIT
