Skip to main content

opencode-cli

CLI tool for opencode server API. Built on top of the official opencode-ai Python SDK.

Installation

pip install opencode-cli

Usage

The oc command provides easy access to opencode server operations:

# List all sessions
oc sessions

# List sessions as JSON
oc sessions --json

# Get session info (by ID or title)
oc info headless-1
oc info ses_abc123

# List messages in a session
oc messages headless-1

# Send a message to a session
oc send headless-1 "hello world"

# Create a new session
oc create --title "My Session"

Features

  • Title resolution: Use session titles instead of IDs (e.g., headless-1 instead of ses_abc123)
  • Rich formatting: Beautiful tables and colored output
  • JSON output: Use --json flag for machine-readable output
  • Built on official SDK: Uses the official opencode-ai package under the hood

Environment Variables

  • OPENCODE_SERVER - Override default server URL (default: http://localhost:36000)

For Python SDK

If you need the full Python SDK (not just CLI), use the official package:

pip install opencode-ai

See official SDK docs for Python API usage.

License

MIT

Metadata

Release files for opencode-cli 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencode-cli 0.1.1
File Size Uploaded
opencode_cli-0.1.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opencode-cli 0.1.1
File Interpreter ABI Platform
opencode_cli-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / opencode_cli-0.1.1.tar.gz

Download URL opencode_cli-0.1.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0acf32e6c3fc1ecc6b2a635cd48bdf6042ff5a8df5e9a25ee59fdcda905361e2
BLAKE2b-256 checksum
How to use checksums
3b01fb00c9768dd903882a71ceb4aec591f349127eee45408a4cdee3258b51b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release files / opencode_cli-0.1.1-py3-none-any.whl

Download URL opencode_cli-0.1.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da4ddd9b79c8d06ad2db44b22339df434a31506c562bf5d4ad8e2a4f47098a33
BLAKE2b-256 checksum
How to use checksums
7e670f1f78167fc0617c21277349df7db26228a45ab9cc711cbe259642b8a9c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page