Back to home

Saul-Soul

dsh-tokenrhythm-attribution-bridge

No description

Stars
0
Language
TypeScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

@deepseek-ai/dsh-tokenrhythm-attribution-bridge

English | 中文

An OpenAI-compatible relay adapter for the deepseek-harness LLM seam that serves exactly one purpose: present the OpenSquilla app identity to TokenRhythm (基元流动) so that relayed token usage is attributed to the OpenSquilla app and counted into the gateway's savings/statistics channel.

This plugin does not itself reduce cost, route models, compute savings, or claim any savings that did not happen. It only signals the app identity that the relay gateway recognizes. Whether the gateway counts the traffic as "savings" is entirely the gateway's decision.

Single purpose

When a harness model call is routed through a TokenRhythm (基元流动) relay endpoint, this adapter adds the two app-attribution headers OpenSquilla sends:

HTTP-Referer: https://opensquilla.ai
X-Title: OpenSquilla

The relay recognizes that identity and attributes the request's token usage to the OpenSquilla app for its own savings statistics. The harness User-Agent always remains and is never suppressed.

The adapter never sends X-OpenSquilla-* headers (such as X-OpenSquilla-Install-Id), because they are not required to identify the app and would leak pseudo-anonymous install/session metadata this bridge deliberately withholds.

Does it save money?

No. This plugin only changes identity signals on the wire. It performs no routing, no model substitution, no prompt rewriting, and no token reduction. Any "savings" path is a property of the relay gateway (TokenRhythm 基元流动), not of this plugin. Treat any claim of savings as an accounting/attribution decision made by the gateway, not by this code.

Install and mount

This package is a harness workspace plugin. Put it at packages/llm/ in a deepseek-harness checkout, run pnpm install, then mount it in cordis.yml:

- id: llm-tokenrhythm
  name: '@deepseek-ai/dsh-tokenrhythm-attribution-bridge'
  config:
    baseURL: https://tokenrhythm.studio/v1   # the 基元流动 relay endpoint
    apiKeyEnv: TOKENRHYTHM_API_KEY
    appAttribution: true                     # send the OpenSquilla identity headers
    models:
      - id: deepseek-v4-flash
        name: DeepSeek-V4-Flash
        contextWindow: 1000000

Then select the route with provider: gateway (or a route you rename) so conversation requests reach this adapter.

Attribution host gate

To avoid mis-attributing ordinary direct provider calls, app identity is sent only under the configured policy:

  • appAttribution omitted ⇒ auto: send only when the baseURL host is openrouter.ai, tokenrhythm.studio, a subdomain of either, or any host containing tokenrhythm. A direct endpoint such as api.deepseek.com receives no identity headers.
  • appAttribution: true ⇒ send to any configured endpoint (use this for a custom base URL).
  • appAttribution: false ⇒ send none; the mandatory User-Agent remains.

The default identity is OpenSquilla's (https://opensquilla.ai / OpenSquilla); override it with appIdentity for a white-label deployment, though that changes what the relay attributes the traffic to.

Scope of this repository

This repository hosts the public plugin source. Its dependencies (@deepseek-ai/dsh-llm, @deepseek-ai/dsh-settings, @deepseek-ai/dsh-credentials, Cordis, etc.) are deepseek-harness workspace packages and are not published here; the plugin runs only inside that workspace.

License

MIT — see LICENSE.