AgentSkillsCN

opper-cli

当您需要通过终端界面调用Opper CLI(oppercli)时,可使用此技能:完成AI任务、管理函数、操作知识库、配置模型、检查调用轨迹、追踪使用情况。当用户希望通过命令行调用Opper函数、管理索引、检查调用轨迹、追踪成本,或通过终端配置模型时,可启用此技能。

SKILL.md
--- frontmatter
name: opper-cli
description: >
  Use the Opper CLI (oppercli) for terminal-based AI task completion, function management, knowledge base operations, model configuration, trace inspection, and usage analytics. Activate when users want to call Opper functions from the command line, manage indexes, inspect traces, track costs, or configure models via terminal.

Opper CLI

Command-line interface for the Opper platform. Call functions, manage knowledge bases, configure models, inspect traces, and track usage from your terminal.

Installation

Homebrew (macOS):

bash
brew tap opper-ai/oppercli git@github.com:opper-ai/oppercli
brew install opper

Binary download (macOS ARM64):

bash
sudo curl -o /usr/local/bin/opper https://github.com/opper-ai/oppercli/releases/latest/download/opper-darwin-arm64
sudo chmod 755 /usr/local/bin/opper

Other platforms: download from GitHub Releases (opper-linux-amd64, opper-darwin-amd64, etc.).

Configuration

Set up your API key:

bash
opper config add default <your-api-key>

Use multiple configurations with the --key flag:

bash
opper config add staging <staging-api-key>
opper call --key staging myfunction "instructions" "input"

Core Command: call

Execute an Opper function from the terminal:

bash
# Basic call
opper call myfunction "respond in kind" "what is 2+2?"

# With a specific model
opper call --model anthropic/claude-4-sonnet myfunction "summarize this" "long text..."

# Pipe input from stdin
echo "what is 2+2?" | opper call myfunction "respond in kind"

Commands Overview

CommandDescription
callExecute a function with instructions and input
functionsList, get, chat with, and run evaluations on functions
indexesManage knowledge base indexes (list, get, create, delete, add, query, upload)
modelsRegister, list, get, test, delete custom models, and list builtins
tracesInspect execution traces
usageTrack usage analytics, tokens, and costs by tags
configManage API key configurations
versionDisplay CLI version

Function Chat

Interactive chat with a function:

bash
opper functions chat myfunction "Hello there!"
echo "Hello there!" | opper functions chat myfunction

Model Management

Register custom models (uses LiteLLM identifiers):

bash
# Register an Azure-deployed model
opper models create my-gpt4 azure/my-gpt4-deployment my-api-key '{"api_base": "https://my.openai.azure.com", "api_version": "2024-02-01"}'

# List registered models
opper models list

# List built-in models
opper models builtin

# Get details of a model
opper models get my-gpt4

# Test a model interactively
opper models test my-gpt4

# Delete a model
opper models delete my-gpt4

Usage Tracking

Query usage analytics with filtering and grouping:

bash
# Usage for a date range grouped by tag
opper usage list --from-date=2025-05-15 --to-date=2025-05-16 --fields=total_tokens --group-by=model

# Time-precise query (RFC3339 format)
opper usage list --from-date=2025-05-15T14:00:00Z --to-date=2025-05-15T16:00:00Z --granularity=minute

# Export as CSV
opper usage list --out=csv

Note: cost and count are always included automatically. Valid --fields values: total_tokens, prompt_tokens, completion_tokens. Do NOT pass count as a field.

Global Flags

FlagDescription
--debugEnable diagnostic output
--key <name>API key configuration to use (default: "default")
-h, --helpShow help for any command

Common Mistakes

  • Missing config: Run opper config add default <key> before using any commands.
  • Wrong argument order for call: It's opper call <function> <instructions> <input>, not opper call <instructions> <function> <input>.
  • Model identifiers: Use LiteLLM format (azure/deployment-name, anthropic/claude-4-sonnet), not raw model names.
  • Piping with chat: When piping, the function name still comes first: echo "hi" | opper functions chat myfunction.

Additional Resources

Related Skills

  • opper-api: Use when you need the full REST API reference for HTTP-based integrations.
  • opper-python-sdk: Use when building Python applications with the Opper SDK.
  • opper-node-sdk: Use when building TypeScript applications with the Opper SDK.

Upstream Sources

When this skill's content may be outdated, resolve using this priority:

  1. Installed CLI — run opper --help and subcommand help to check current commands and options
  2. Source code: https://github.com/opper-ai/oppercli