Skip to content

Other harnesses

Any client that lets you set a custom baseURL works with cmx. The contract is three things:

  1. baseURLhttp://127.0.0.1:17322
  2. cmx-provider header → the upstream provider name from cmx config
  3. cmx-harness header → a label for the UI (any string)

Auth stays where it belongs: your harness sends its own Authorization / API key, cmx forwards it to the upstream untouched.

Client type Path Format
OpenAI-style POST /v1/chat/completions chat.completion objects
Anthropic-style POST /v1/messages message objects

Streaming (SSE) and non-streaming are both supported for both dialects. Unknown paths are passed through to the upstream unchanged.

cmx groups requests into sessions by looking for, in order:

  • cmx-session-id
  • x-opencode-session
  • x-session-id
  • x-claude-session-id

If none is present, it falls back to a fingerprint of model + system prompt + first message — good enough for most CLI agents, but an explicit header is more reliable.

  • Adds <cmx-id-*> markers to older messages (harmless text to the model)
  • Adds the compress tool if not already present
  • Strips compress tool calls from responses before the harness sees them
  • Occasionally appends a small <cmx-system-reminder> nudge to the last user message when context is large
  • Never modifies stored session history — rewrites happen only in the proxied request