Getting Started

CLI Reference

Use the mql CLI to manage proxy keys, prompts, organizations, filters, analytics, subscriptions, and more — all from your terminal.

Installation

Install
# Via npm (recommended)
npm install -g mql-cli

# Or use npx directly
npx mql-cli --help

Authentication

Auth Commands
# Interactive login (opens browser)
mql auth login

# Login with a token directly
mql auth login --token mql_your_token

# Check authentication status
mql auth status

# Show current user info
mql auth whoami

# Logout
mql auth logout

# Set API URL (for self-hosted)
mql auth set-url https://api.your-instance.com

Profile

Profile Commands
# View your profile
mql profile view

# Update your profile
mql profile update --name "Jane Doe" --company "Acme" --job-title "Engineer"

# Output as JSON
mql profile view --json

Proxy Keys

Create, manage, and test proxy keys. Keys can have prompts and filters attached to them.

Key Management
# List all proxy keys
mql keys list

# Create a new key
mql keys create --name "production-key"

# Get key configuration
mql keys config mql_abc123

# Regenerate a key (invalidates old)
mql keys regenerate mql_abc123

# Test a key with a simple request
mql keys test mql_abc123 --message "Hello!"

# Delete a key
mql keys delete mql_abc123

# Org-scoped keys
mql keys list --org org_abc123

Key Analytics & Logs

Key Usage
# Get usage stats for a key
mql keys usage mql_abc123

# Detailed analytics with date range
mql keys analytics mql_abc123 --from 2025-01-01 --to 2025-01-31

# Get request logs
mql keys logs mql_abc123 --limit 50

# Get pricing info
mql keys pricing mql_abc123

Key Prompt Attachment

Prompt Attachment
# List prompts attached to a key
mql keys prompts mql_abc123

# Attach a prompt to a key (as system prompt)
mql keys attach mql_abc123 prompt_456

# Detach a prompt
mql keys detach mql_abc123 prompt_456

# Set multiple system prompts at once
mql keys set-prompts mql_abc123 prompt_1 prompt_2 prompt_3

# Set filters for a key
mql keys set-filters mql_abc123 filter_1 filter_2

PromptHub

Create, manage, publish, and share prompts from the terminal.

Prompt CRUD
# List your prompts
mql prompts list
mql prompts list --search "code review" --visibility private

# Get a prompt by ID
mql prompts get prompt_abc123
mql prompts get prompt_abc123 --content  # show full content

# Create a prompt
mql prompts create --name "Code Reviewer" \
  --content "You are an expert code reviewer. Review code for bugs, security issues..." \
  --mode system --priority 10 --category "Development" --tags "code,review"

# Create from a file
mql prompts create --name "Translator" --file ./translator-prompt.txt

# Update a prompt
mql prompts update prompt_abc123 --name "Updated Name" --content "New content..."

# Delete
mql prompts delete prompt_abc123

Publishing & Sharing

Publish & Share
# Publish to the public hub
mql prompts publish prompt_abc123 --slug "my-code-reviewer" --category "Development"

# Unpublish
mql prompts unpublish prompt_abc123

# Generate a share link
mql prompts share prompt_abc123 --permission view --expires 7d

# Star / Unstar a prompt
mql star prompt_abc123
mql unstar prompt_abc123

# Fork a public prompt
mql fork prompt_abc123

Organizations

Organization Management
# List your organizations
mql orgs list

# Create an organization
mql orgs create --name "my-team" --display-name "My Team"

# Get organization details
mql orgs get org_abc123

# Get org dashboard with usage stats
mql orgs dashboard org_abc123

# List members
mql orgs members org_abc123

# Invite a member
mql orgs invite org_abc123 --email "dev@company.com" --role member

# Update a member's role
mql orgs update-role org_abc123 member_id admin

# Remove a member
mql orgs remove-member org_abc123 member_id

# List pending invitations
mql orgs invites org_abc123

# Cancel / Resend invitation
mql orgs cancel-invite org_abc123 invite_id
mql orgs resend-invite org_abc123 invite_id

# View your pending invites
mql orgs my-invites

# Accept an invitation
mql orgs accept <invitation_token>

Content Filters

Filter Management
# List filters
mql filters list
mql filters list --org org_abc123

# Create a filter
mql filters create --name "Block PII" --type input \
  --pattern "\\b\\d{3}-\\d{2}-\\d{4}\\b" \
  --action block

# Create with redaction
mql filters create --name "Redact Emails" --type both \
  --pattern "[a-z]+@[a-z]+\\.com" \
  --action redact --replacement "[REDACTED]"

# Update a filter
mql filters update filter_abc123 --name "Updated Name" --priority 5

# Toggle enable/disable
mql filters toggle filter_abc123

# Delete
mql filters delete filter_abc123

# List available templates
mql filters templates

# Create from a template
mql filters from-template pii-ssn --name "SSN Filter"

# Test a pattern against input
mql filters test --pattern "\\d{3}-\\d{2}-\\d{4}" \
  --input "My SSN is 123-45-6789" --action redact

Analytics

Usage Analytics
# Overview (total requests, tokens, cost, errors)
mql analytics overview
mql analytics overview --from 2025-01-01 --to 2025-01-31

# Scoped to a specific key
mql analytics overview --key mql_abc123

# Time-series data
mql analytics timeseries --interval day
mql analytics timeseries --interval hour --from 2025-01-20

# Provider breakdown
mql analytics providers

# Quick shortcuts
mql analytics today
mql analytics week

Models & Pricing

Model Discovery
# List available models for a provider
mql models list openai
mql models list anthropic

# Discover models using your own API key
mql models discover openai --api-key "sk-..."

# Get pricing for a provider
mql models pricing openai

# List supported providers
mql models providers

Subscription & Plans

Subscription Management
# Check current subscription status
mql subscription status
mql subscription status --org org_abc123

# View plan limits
mql subscription limits

# Trial management
mql subscription trial status
mql subscription trial start          # Start 14-day Enterprise trial
mql subscription trial start --org org_abc123

Command Reference

Complete list of all commands and subcommands.

CommandSubcommands
mql authlogin, logout, status, whoami, set-url
mql profileview, update
mql keyslist, create, delete, regenerate, usage, analytics, logs, test, config, prompts, attach, detach, pricing, set-prompts, set-filters
mql promptslist, get, create, update, delete, publish, unpublish, share
mql orgslist, create, get, dashboard, members, invite, remove-member, update-role, invites, cancel-invite, resend-invite, accept, my-invites
mql filterslist, create, update, delete, toggle, templates, from-template, test
mql analyticsoverview, timeseries, providers, today, week
mql modelslist, discover, pricing, providers
mql subscriptionstatus, limits, trial status, trial start
mql star / unstar / forkStar, unstar, or fork a public prompt

JSON Output

Most commands support a --json flag for machine-readable output, perfect for scripting and CI/CD pipelines.

Help

Run mql --help or mql <command> --help for detailed usage of any command.