Skip to main content

CMDOP umbrella package — reusable server-side features (codegen, …) extracted from the relay.

Project description

cmdop-server

CMDOP server — your own self-hostable relay

The umbrella package for reusable CMDOP server-side features — heavy, self-contained pieces lifted out of the relay repo so the repo stays light. This is not the whole relay (run that from the repo); it's an installable home for features other projects can reuse.

pip install cmdop-server

📚 docs.cmdop.com · Server · Connect · Bots · SDK

Features

cmdop_server.codegen — multi-language client generator

A monorepo-agnostic code-generation engine: declarative targets (proto / OpenAPI / WebSocket) → typed clients in Go, TypeScript, Python, Swift. You supply a Config describing your sources + outputs; the engine drives the toolchains (grpc_tools, ogen, @hey-api, openapi-python-client, swift-openapi, a built-in WS emitter).

from cmdop_server.codegen.schema import Config, ProtoSpec, ProtoTarget, Lang, Tool
from cmdop_server.codegen.core.runner import run

cfg = Config(proto=ProtoSpec(targets=[ProtoTarget(
    name="proto-python", lang=Lang.PY, tool=Tool.GRPC_PYTHON,
    path=my_out_dir, proto_dirs=[my_proto_dir],
)]))
run(cfg, kinds=("proto",))

Or the CLI, pointing at a module that exposes config: Config:

python -m cmdop_server.codegen --config myproject.codegen_config gen all

External toolchains (ogen, buf, swift-openapi, @hey-api) are subprocess prerequisites — install the ones your targets use.

cmdop_server.llm — universal LLM transport

One module for every model call — chat, structured extraction (Pydantic response_format with parse-and-repair), vision, image generation/edit, embeddings, translation. It owns HTTP, auth, cost-per-response, retries, a live OpenRouter model registry (pricing + capabilities), and a cascade LLMRouter with role presets. Provider-agnostic (OpenAI / OpenRouter).

from cmdop_server.llm import LLMClient

client = LLMClient(api_key="sk-...")        # or omit → reads OPENROUTER_API_KEY / OPENAI_API_KEY
resp = client.chat("Summarize this.", model="alias:balanced")
print(resp.content, resp.cost_usd)

Config is hybrid (the openai/stripe-SDK pattern): pass keys explicitly, or let them fall back to env (OPENROUTER_API_KEY, OPENAI_API_KEY, or the CMDOP_DEV_LLM_KEYS__* form). No global Django config — explicit always wins.

cmdop_server.telegram — Telegram notification service

A small, framework-neutral Telegram sender (queue + formatters + parse-mode handling) used for alerts/notifications. Reads CMDOP_TELEGRAM_BOT_TOKEN / CMDOP_TELEGRAM_CHAT_ID from env, or take them per-call.

All three features are framework-neutral — no Django. cmdop_server.llm and cmdop_server.telegram were ported from django_cfg; the single host seam is cmdop_server._compat (env-driven config + a tiny TTL cache).

Run the relay itself

This package is server-side features, not the server. To run a CMDOP relay, clone and run the repo: github.com/commandoperator/cmdop-server.

Apache-2.0.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

cmdop_server-0.0.6-py3-none-any.whl (350.6 kB view details)

Uploaded Python 3

File details

Details for the file cmdop_server-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: cmdop_server-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 350.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cmdop_server-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 92ea8b45292559c8f4d0e3deef52660346b0aee88170684f1bf625db7a7db1a2
MD5 cd1945b74f7fbcc428450f39bd6bff5c
BLAKE2b-256 d50c714c22581f226fe1502bfe4f016629baaf8501301fcb286f3d87126bd638

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