Cosmic CLI
The Cosmic CLI is an AI-powered command-line interface that enables developers to build apps, manage content, deploy code, and orchestrate AI agents entirely from the terminal.
What is Cosmic CLI?
Introducing the Cosmic CLI: AI-Powered Content and Code Management from Your Terminal
What is Cosmic CLI?
The Cosmic CLI is a powerful, AI-enhanced command-line interface designed to bring the full spectrum of the Cosmic platform capabilities directly into your terminal environment. It fundamentally aims to collapse the traditional, multi-step development workflow—which often involves schema design, admin interface building, frontend coding, and CI/CD configuration—into a handful of rapid, natural language commands. By integrating AI agents directly into the command line, developers can go from an initial idea to a fully functional, production-ready application deployed on platforms like Vercel in minutes, all without ever leaving their preferred keyboard-driven workflow.
This tool recognizes that while the Cosmic dashboard offers a robust visual environment, developers thrive in the terminal for scripting, automation, and speed. The Cosmic CLI is more than just a wrapper for API calls; it features an interactive shell, context-aware prompts, and sophisticated AI chat modes that understand your content structure and codebase, allowing for complex operations to be executed with simple, conversational instructions.
Key Features
The Cosmic CLI is packed with features engineered for speed, automation, and developer efficiency:
- AI-Powered Content Management: Utilize the Content Agent to research topics, match existing content styles, and automatically create and structure content objects within your Cosmic buckets using natural language.
- Natural Language Application Building: Generate complete, production-ready applications connected to your Cosmic project simply by describing what you need. The CLI handles scaffolding, GitHub repository creation, and deployment preparation.
- Intelligent Code Updates: The Code Agent connects to existing repositories, analyzes the codebase, intelligently implements requested changes based on instructions, creates feature branches, and commits updates.
- One-Command Deployment: Seamlessly deploy applications directly to Vercel, complete with built-in management for environment variables, custom domains, and real-time log streaming.
- Interactive Shell: Start a persistent session where commands can be run without prefixes, allowing for filesystem-style navigation of your Cosmic workspace and easy execution of system commands.
- AI Agent Orchestration: Create, run, and manage all three types of AI agents (Content, Code, Computer Use) directly from the CLI, including the ability to chain them into automated, multi-step AI Workflows.
- Multi-Model AI Support: Flexibility to choose from leading AI providers, including Anthropic (Claude), OpenAI (GPT), and Google (Gemini), setting your preferred default model.
- Filesystem Navigation: Navigate your Cosmic workspace hierarchy (buckets, projects) as intuitively as navigating a local filesystem.
How to Use Cosmic CLI
Getting started with the Cosmic CLI is designed to be fast and straightforward. The initial setup involves a global installation and authentication.
1. Installation: Install the CLI globally using npm or bun:
npm install -g @cosmicjs/cli
bun install -g @cosmicjs/cli
2. Authentication: Log in to your account to gain full dashboard access, or use a specific bucket key for focused operations:
cosmic login
# OR for specific bucket access
cosmic login --bucket-key <YOUR_KEY>
3. Core Workflows: Once authenticated, you can immediately leverage its power:
- To Build: Use a command like
cosmic build "Create a Next.js blog template with a 'Posts' content type and deploy to Vercel". - To Manage Content: Enter the interactive shell (
cosmic shell) and use conversational commands likecontent create "Write an article about quantum computing matching my existing style". - To Update Code: Navigate to your project directory and run
cosmic code update "Add a dark mode toggle to the header component". - To Deploy: Execute
cosmic deploy --target vercelto push your latest changes live.
The CLI automatically handles context, API keys, and environment configuration based on your current directory or specified flags, ensuring a smooth transition between development tasks.
Use Cases
The Cosmic CLI is ideal for developers and teams looking to maximize terminal efficiency and leverage generative AI for routine tasks:
- Rapid Prototyping & MVPs: Quickly scaffold entire application structures, including backend content models and frontend boilerplate, using a single natural language prompt, drastically cutting down initial setup time.
- Automated Content Ingestion: For large-scale content migration or ongoing data entry, use the Content Agent within CI/CD pipelines to research, structure, and inject thousands of content objects automatically.
- On-the-Fly Code Refactoring: When a feature needs a quick adjustment or a bug fix, developers can use the Code Agent to generate the necessary changes, create a feature branch, and open a PR directly from the terminal, avoiding context switching to a GUI.
- CI/CD Integration: Integrate complex deployment and environment configuration steps directly into automated scripts. The CLI ensures consistent, repeatable deployments across staging and production environments using environment variable management.
- AI Agent Management: Teams building complex automation solutions can use the CLI to manage, test, and orchestrate sophisticated multi-step AI Workflows that handle complex business logic without manual intervention.
FAQ
Q: Is the Cosmic CLI a replacement for the Cosmic Dashboard? A: No. The CLI is designed to complement the dashboard. It excels at speed, automation, and keyboard-driven workflows, while the dashboard remains the preferred environment for visual content editing, complex UI configuration, and high-level project oversight.
Q: Which AI models can I use with the CLI? A: The CLI supports multiple leading models, including Anthropic's Claude, OpenAI's GPT series, and Google's Gemini. You can configure your preferred default model using CLI flags or configuration settings.
Q: Does the CLI respect my existing Cosmic plan limits? A: Yes. The Cosmic CLI respects the exact same plan-based limits (e.g., API calls, agent usage) as the standard Cosmic dashboard. All actions performed via the CLI count against your established account quotas.
Q: How does authentication work for security? A: You can authenticate using your main Cosmic user credentials for full access, or use specific Bucket Keys for restricted, automated access. The CLI securely manages these credentials, ensuring API keys are correctly configured for local development and deployment tasks.
Q: Can I use the CLI to manage my Vercel deployments? A: Absolutely. The CLI has built-in integration for Vercel, allowing you to trigger deployments, manage custom domains, configure environment variables specific to the deployment target, and stream real-time logs directly from your terminal.
Alternatives
Devin
Devin is an AI coding agent and software engineer that helps developers build better software faster.
SkillKit
SkillKit provides a universal set of skills allowing developers to write code instructions once and deploy them across 32 different AI coding agents, ensuring consistency and broad compatibility.
CodeSandbox
CodeSandbox is a cloud development platform that empowers developers to code, collaborate and ship projects of any size from any device in record time.
AakarDev AI
AakarDev AI is a powerful platform that simplifies the development of AI applications with seamless vector database integration, enabling rapid deployment and scalability.
imgcook
imgcook is an intelligent tool that converts design mockups into high-quality, production-ready code with a single click.
Claude Opus 4.5
Introducing the best model in the world for coding, agents, computer use, and enterprise workflows.