Skip to main content

PrimeThink CLI - A powerful tool for interacting with PrimeThink AI API

Project description

PrimeThink CLI

Command Line Interface for interacting with the PrimeThink API.

Installation

pip install primethink-cli

Quick Start

  1. Configure your API token:
pt configure --token YOUR_API_TOKEN
  1. Use the CLI commands:
pt available-actions
pt execute-action --action "action-name" --message "your message"
pt send-message CHAT_ID --message "your message"
pt send-message --agent AGENT_ID --message "your message"

Configuration

Token Management

The CLI supports multiple token profiles, allowing you to switch between different accounts or API endpoints.

Configure a new profile

pt configure --token YOUR_API_TOKEN --profile default

Options:

  • --token, -t: Your API token (required)
  • --profile, -p: Profile name (default: "default")
  • --api-url, -u: Custom API URL (optional, default: https://api.primethink.ai)

List all profiles

pt list-profiles

Switch to a different profile

pt use PROFILE_NAME

Remove a profile

pt remove-profile PROFILE_NAME

Commands

Version

Display the CLI version:

pt version

Available Actions

Get a list of available task actions:

pt available-actions

You can use a specific profile for a single request without switching the active profile:

pt available-actions --profile production

You can also override the API URL for a single request:

pt available-actions --api-url https://custom-api.example.com

Execute Task Action

Execute a task action with a message and optional files:

pt execute-action --action "action-name" --message "your message"

With files:

pt execute-action --action "action-name" --message "your message" --files file1.txt --files file2.txt

Options:

  • --action, -a: Task action name (required)
  • --message, -m: Message input (required)
  • --files, -f: Files to attach (can be specified multiple times)
  • --return-original: Return original message (flag)
  • --profile, -p: Profile to use for this request (optional)
  • --api-url, -u: Override API URL for this request (optional)

Send Message to Chat

Send a message to an existing chat by ID or mention name:

pt send-message CHAT_ID_OR_MENTION --message "your message"

You can use either a chat ID or mention name:

# By chat ID
pt send-message 123 --message "your message"

# By mention name
pt send-message @my-assistant --message "your message"

With files:

pt send-message 123 --message "your message" --files file1.txt --files file2.txt

Options:

  • CHAT_ID_OR_MENTION: The chat ID or mention name (optional, positional argument)
  • --message, -m: Message input (required)
  • --files, -f: Files to attach (can be specified multiple times)
  • --async: Asynchronous request (flag, default: false, applies only to chat messages)
  • --agent, -a: Agent ID to send message to (optional, use instead of CHAT_ID_OR_MENTION)
  • --profile, -p: Profile to use for this request (optional)
  • --api-url, -u: Override API URL for this request (optional)

Note: You must provide either CHAT_ID_OR_MENTION or --agent, but not both.

Send Message to Agent

Send a message directly to an agent using the --agent option:

pt send-message --agent 1 --message "your message"

With files:

pt send-message --agent 1 --message "Analyze this data" --files data.csv

Configuration File

The CLI stores configuration in ~/.primethink/config.json. This file contains:

  • Active profile
  • All configured profiles with their tokens and optional custom API URLs

Example structure:

{
  "active_profile": "default",
  "profiles": {
    "default": {
      "token": "your-api-token"
    },
    "custom": {
      "token": "your-custom-token",
      "api_url": "https://custom-api.example.com"
    }
  }
}

Development

Install development dependencies

pip install -e ".[dev]"

Run tests

pytest

Run tests with coverage

pytest --cov=primethink --cov-report=html

Examples

Example 1: Configure and use the CLI

# Configure your token
pt configure --token YOUR_API_TOKEN

# List available actions
pt available-actions

# Execute an action
pt execute-action --action "summarize" --message "Summarize this text"

Example 2: Using multiple profiles

# Configure default profile
pt configure --token YOUR_TOKEN --profile default

# Configure a custom API endpoint profile
pt configure --token CUSTOM_TOKEN --profile production --api-url https://prod-api.example.com

# List profiles
pt list-profiles

# Switch to production profile
pt use production

# Or use a specific profile for a single command without switching
pt available-actions --profile production
pt send-message 123 --message "Hello" --profile default

# Switch back to default
pt use default

Example 3: Sending messages with files

# Send a message to a chat with multiple files
pt send-message 123 --message "Here are the documents" --files report.pdf --files data.csv

# Send message by mention name
pt send-message @my-assistant --message "Review this"

# Send to agent with a specific profile
pt send-message --agent 1 --message "Help me with this task" --files data.csv --profile production

# Use a custom API URL for a single request
pt send-message 123 --message "Hello" --api-url https://custom-api.example.com

License

MIT License

Support

For issues and questions, please visit: https://primethink.ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

primethink_cli-1.0.1.tar.gz (149.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

primethink_cli-1.0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file primethink_cli-1.0.1.tar.gz.

File metadata

  • Download URL: primethink_cli-1.0.1.tar.gz
  • Upload date:
  • Size: 149.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for primethink_cli-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ef10a3db30a73a4e4d186373ff8daed4bde43a02336c03bd6326737ec63bf8be
MD5 531d83c9fc6ad9945489392c248abddc
BLAKE2b-256 c10abddf07cfe42130aedd32e2142131b8b285a76f9a77c0ae411424ecaf4796

See more details on using hashes here.

File details

Details for the file primethink_cli-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: primethink_cli-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for primethink_cli-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1fcbd1f67e29f5af5bf66362c09a20239e396ee1b18692b0c08a004685f9e0ff
MD5 e5517158cca8775c268b269b05627519
BLAKE2b-256 735ad0e4cab887bfb807b0f994827b492d2b90f085f3cd9203ee5ea838ec36ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page