xithead 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/xithead.js +486 -226
- package/index.d.ts +57 -0
- package/index.js +139 -0
- package/package.json +44 -63
- package/postinstall.js +43 -0
- package/LICENSE +0 -190
- package/README.md +0 -108
- package/app/api/config/route.ts +0 -22
- package/app/api/export/route.ts +0 -83
- package/app/api/models/route.ts +0 -12
- package/app/api/stats/route.ts +0 -46
- package/app/dashboard/page.tsx +0 -445
- package/app/globals.css +0 -35
- package/app/installation/page.tsx +0 -293
- package/app/layout.tsx +0 -35
- package/app/master-design-system.css +0 -2076
- package/app/master-design-system.source.css +0 -8
- package/app/page.tsx +0 -187
- package/app/rechtliches/agb/page.tsx +0 -165
- package/app/rechtliches/datenschutz/page.tsx +0 -128
- package/app/rechtliches/impressum/page.tsx +0 -122
- package/app/rechtliches/widerruf/page.tsx +0 -185
- package/components/layout/AppShell.tsx +0 -25
- package/components/layout/Footer.tsx +0 -120
- package/components/layout/Header.tsx +0 -145
- package/components/marketing/LegalHighlights.tsx +0 -45
- package/components/marketing/LegalPageShell.tsx +0 -49
- package/components/marketing/LegalPanel.tsx +0 -41
- package/components/marketing/index.ts +0 -3
- package/design-system/README.md +0 -80
- package/design-system/base.css +0 -127
- package/design-system/components.css +0 -1943
- package/design-system/fonts.css +0 -17
- package/design-system/tailwind-preset.js +0 -95
- package/design-system/tokens.css +0 -48
- package/design-system/utilities.css +0 -53
- package/lib/config/index.ts +0 -12
- package/lib/hooks/index.ts +0 -4
- package/lib/hooks/use-mounted.ts +0 -13
- package/lib/hooks/use-session.ts +0 -34
- package/lib/hooks/use-settings.ts +0 -49
- package/lib/utils/index.ts +0 -1
- package/lib/utils/settings.ts +0 -162
- package/lib/utils/utils.ts +0 -6
- package/middleware.ts +0 -26
- package/next-env.d.ts +0 -7
- package/next.config.ts +0 -12
- package/postcss.config.mjs +0 -7
- package/public/apple-touch-icon.png +0 -0
- package/public/logo-transparent.png +0 -0
- package/public/xithead.ps1 +0 -937
- package/scripts/README.md +0 -77
- package/scripts/audit_wheel_glibc_symbols.py +0 -217
- package/scripts/build-master-design-system.cjs +0 -33
- package/scripts/build_rust_extension.sh +0 -58
- package/scripts/changelog-gen.py +0 -203
- package/scripts/eval_output_shaper.py +0 -235
- package/scripts/export_kompress_v2_onnx.py +0 -267
- package/scripts/fixtures/anthropic_replay_body.json +0 -133
- package/scripts/fixtures/codex_response_create_frame.json +0 -52
- package/scripts/install-git-hooks.sh +0 -104
- package/scripts/install.ps1 +0 -1809
- package/scripts/install.sh +0 -1673
- package/scripts/pr-governance.py +0 -297
- package/scripts/record_fixtures.py +0 -59
- package/scripts/refresh_model_limits.sh +0 -48
- package/scripts/replay_codex_ws_load.py +0 -445
- package/scripts/repro_codex_replay.py +0 -699
- package/scripts/smoke_issue_327.py +0 -233
- package/scripts/sync-plugin-versions.py +0 -116
- package/scripts/tests/test_changelog_gen.py +0 -302
- package/scripts/tests/test_pr_governance.py +0 -163
- package/scripts/tests/test_pr_health_labels.py +0 -94
- package/scripts/tests/test_pr_health_workflow.py +0 -14
- package/scripts/tests/test_sync_plugin_versions.py +0 -131
- package/scripts/tests/test_version_sync.py +0 -291
- package/scripts/validate-workflows.sh +0 -39
- package/scripts/verify-versions.py +0 -106
- package/scripts/version-sync.py +0 -207
- package/tailwind.config.js +0 -31
- package/tailwind.master.config.cjs +0 -47
- package/tsconfig.json +0 -84
- package/types/api.ts +0 -12
- package/types/config.ts +0 -9
- package/types/index.ts +0 -2
package/index.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xithead - Claude Context Optimizer
|
|
3
|
+
* by Xtream-ITSolutions UG
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface Message {
|
|
7
|
+
role: 'user' | 'assistant';
|
|
8
|
+
content: string | ContentBlock[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ContentBlock {
|
|
12
|
+
type: 'text' | 'image' | 'tool_use' | 'tool_result';
|
|
13
|
+
text?: string;
|
|
14
|
+
cache_control?: { type: 'ephemeral' };
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface OptimizeOptions {
|
|
19
|
+
messages: Message[];
|
|
20
|
+
system?: string | ContentBlock[];
|
|
21
|
+
model?: string;
|
|
22
|
+
enableCacheControl?: boolean;
|
|
23
|
+
enableDedup?: boolean;
|
|
24
|
+
enableSystemCompress?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface OptimizeResult {
|
|
28
|
+
messages: Message[];
|
|
29
|
+
system?: string | ContentBlock[];
|
|
30
|
+
tokensSaved: number;
|
|
31
|
+
costSavedUsd: number;
|
|
32
|
+
compressionRatio: number;
|
|
33
|
+
techniquesApplied: string[];
|
|
34
|
+
model: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface XitheadStats {
|
|
38
|
+
requests: number;
|
|
39
|
+
tokensSaved: number;
|
|
40
|
+
costSavedUsd: number;
|
|
41
|
+
avgTokensSaved: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function optimize(options: OptimizeOptions): OptimizeResult;
|
|
45
|
+
export function injectCacheControl(messages: Message[], system?: string | ContentBlock[], minTokens?: number): { messages: Message[]; system?: string | ContentBlock[] };
|
|
46
|
+
export function dedupMessages(messages: Message[]): { messages: Message[]; changed: boolean };
|
|
47
|
+
export function estimateTokens(text: string): number;
|
|
48
|
+
export function createOptimizedClient(anthropicClient: unknown): {
|
|
49
|
+
messages: {
|
|
50
|
+
create(params: Record<string, unknown>): Promise<unknown>;
|
|
51
|
+
stream(params: Record<string, unknown>): unknown;
|
|
52
|
+
};
|
|
53
|
+
getStats(): XitheadStats;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const CLAUDE_INPUT_COST_PER_TOKEN: number;
|
|
57
|
+
export const CLAUDE_CACHE_READ_COST: number;
|
package/index.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xithead — Claude Code Proxy
|
|
3
|
+
* by Xtream-ITSolutions UG | xtream-itsolutions.com
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const CLAUDE_INPUT_COST_PER_TOKEN = 3e-6;
|
|
8
|
+
const CLAUDE_CACHE_READ_COST = 0.30e-6;
|
|
9
|
+
|
|
10
|
+
function estimateTokens(text) {
|
|
11
|
+
return Math.ceil(text.length / 4);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function injectCacheControl(messages, system, minTokens = 1024) {
|
|
15
|
+
let optimizedSystem = system;
|
|
16
|
+
let optimizedMessages = [...messages];
|
|
17
|
+
|
|
18
|
+
if (typeof system === 'string' && estimateTokens(system) >= minTokens) {
|
|
19
|
+
optimizedSystem = [{ type: 'text', text: system, cache_control: { type: 'ephemeral' } }];
|
|
20
|
+
} else if (Array.isArray(system)) {
|
|
21
|
+
optimizedSystem = system.map((block, i) => {
|
|
22
|
+
if (block.type === 'text' && estimateTokens(block.text || '') >= minTokens && i === system.length - 1) {
|
|
23
|
+
return { ...block, cache_control: { type: 'ephemeral' } };
|
|
24
|
+
}
|
|
25
|
+
return block;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
for (let i = optimizedMessages.length - 1; i >= 0; i--) {
|
|
30
|
+
const msg = optimizedMessages[i];
|
|
31
|
+
if (msg.role === 'user') {
|
|
32
|
+
const content = msg.content;
|
|
33
|
+
if (typeof content === 'string' && estimateTokens(content) >= minTokens) {
|
|
34
|
+
optimizedMessages[i] = {
|
|
35
|
+
...msg,
|
|
36
|
+
content: [{ type: 'text', text: content, cache_control: { type: 'ephemeral' } }]
|
|
37
|
+
};
|
|
38
|
+
} else if (Array.isArray(content)) {
|
|
39
|
+
optimizedMessages[i] = {
|
|
40
|
+
...msg,
|
|
41
|
+
content: content.map((block, j) => {
|
|
42
|
+
const text = block.text || block.content || '';
|
|
43
|
+
if (estimateTokens(String(text)) >= minTokens && j === content.length - 1) {
|
|
44
|
+
return { ...block, cache_control: { type: 'ephemeral' } };
|
|
45
|
+
}
|
|
46
|
+
return block;
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return { messages: optimizedMessages, system: optimizedSystem };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function dedupMessages(messages) {
|
|
58
|
+
if (messages.length < 2) return { messages, changed: false };
|
|
59
|
+
const result = [messages[0]];
|
|
60
|
+
let changed = false;
|
|
61
|
+
for (let i = 1; i < messages.length; i++) {
|
|
62
|
+
const cur = messages[i];
|
|
63
|
+
const prev = result[result.length - 1];
|
|
64
|
+
if (cur.role === prev.role && JSON.stringify(cur.content) === JSON.stringify(prev.content)) {
|
|
65
|
+
changed = true;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
result.push(cur);
|
|
69
|
+
}
|
|
70
|
+
return { messages: result, changed };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function optimize({ messages, system, model = 'claude-sonnet-4-6', enableCacheControl = true, enableDedup = true } = {}) {
|
|
74
|
+
const techniques = [];
|
|
75
|
+
let msgs = [...messages];
|
|
76
|
+
let sys = system;
|
|
77
|
+
|
|
78
|
+
const originalTokens = estimateTokens(JSON.stringify(msgs) + JSON.stringify(sys || ''));
|
|
79
|
+
|
|
80
|
+
if (enableDedup) {
|
|
81
|
+
const { messages: deduped, changed } = dedupMessages(msgs);
|
|
82
|
+
if (changed) { msgs = deduped; techniques.push('dedup'); }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (enableCacheControl) {
|
|
86
|
+
const result = injectCacheControl(msgs, sys);
|
|
87
|
+
msgs = result.messages;
|
|
88
|
+
sys = result.system;
|
|
89
|
+
techniques.push('cache_control');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const optimizedTokens = estimateTokens(JSON.stringify(msgs) + JSON.stringify(sys || ''));
|
|
93
|
+
const tokensSaved = Math.max(0, originalTokens - optimizedTokens);
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
messages: msgs,
|
|
97
|
+
system: sys,
|
|
98
|
+
tokensSaved,
|
|
99
|
+
costSavedUsd: tokensSaved * CLAUDE_INPUT_COST_PER_TOKEN,
|
|
100
|
+
compressionRatio: originalTokens > 0 ? tokensSaved / originalTokens : 0,
|
|
101
|
+
techniquesApplied: techniques,
|
|
102
|
+
model,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function createOptimizedClient(anthropicClient) {
|
|
107
|
+
const stats = { requests: 0, tokensSaved: 0, costSavedUsd: 0 };
|
|
108
|
+
return {
|
|
109
|
+
messages: {
|
|
110
|
+
create(params) {
|
|
111
|
+
const result = optimize({ messages: params.messages || [], system: params.system, model: params.model });
|
|
112
|
+
stats.requests++;
|
|
113
|
+
stats.tokensSaved += result.tokensSaved;
|
|
114
|
+
stats.costSavedUsd += result.costSavedUsd;
|
|
115
|
+
return anthropicClient.messages.create({ ...params, messages: result.messages, system: result.system });
|
|
116
|
+
},
|
|
117
|
+
stream(params) {
|
|
118
|
+
const result = optimize({ messages: params.messages || [], system: params.system, model: params.model });
|
|
119
|
+
stats.requests++;
|
|
120
|
+
stats.tokensSaved += result.tokensSaved;
|
|
121
|
+
stats.costSavedUsd += result.costSavedUsd;
|
|
122
|
+
return anthropicClient.messages.stream({ ...params, messages: result.messages, system: result.system });
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
getStats() {
|
|
126
|
+
return { ...stats, avgTokensSaved: stats.requests > 0 ? stats.tokensSaved / stats.requests : 0 };
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
module.exports = {
|
|
132
|
+
optimize,
|
|
133
|
+
createOptimizedClient,
|
|
134
|
+
injectCacheControl,
|
|
135
|
+
dedupMessages,
|
|
136
|
+
estimateTokens,
|
|
137
|
+
CLAUDE_INPUT_COST_PER_TOKEN,
|
|
138
|
+
CLAUDE_CACHE_READ_COST,
|
|
139
|
+
};
|
package/package.json
CHANGED
|
@@ -1,77 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xithead",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "1.5.2",
|
|
4
|
+
"description": "Lokaler Claude-Code-Proxy — Prompt-Cache maximieren, Token-Kosten senken. By Xtream-ITSolutions UG.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude",
|
|
7
|
+
"anthropic",
|
|
8
|
+
"llm",
|
|
9
|
+
"token",
|
|
10
|
+
"optimization",
|
|
11
|
+
"caching",
|
|
12
|
+
"proxy",
|
|
13
|
+
"context",
|
|
14
|
+
"ai",
|
|
15
|
+
"cost-reduction",
|
|
16
|
+
"claude-code",
|
|
17
|
+
"xithead"
|
|
18
|
+
],
|
|
19
|
+
"author": "Xtream-ITSolutions UG <hello@xtream-itsolutions.com>",
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"homepage": "https://xtream-itsolutions.com",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/Xtream-ITSolutions/homepage.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/Xtream-ITSolutions/homepage/issues"
|
|
28
|
+
},
|
|
6
29
|
"bin": {
|
|
7
30
|
"xithead": "bin/xithead.js"
|
|
8
31
|
},
|
|
9
32
|
"files": [
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"scripts",
|
|
17
|
-
"types",
|
|
18
|
-
"middleware.ts",
|
|
19
|
-
"next.config.ts",
|
|
20
|
-
"next-env.d.ts",
|
|
21
|
-
"postcss.config.mjs",
|
|
22
|
-
"tailwind.config.js",
|
|
23
|
-
"tailwind.master.config.cjs",
|
|
24
|
-
"tsconfig.json",
|
|
25
|
-
"LICENSE",
|
|
26
|
-
"README.md"
|
|
33
|
+
"index.js",
|
|
34
|
+
"postinstall.js",
|
|
35
|
+
"index.d.ts",
|
|
36
|
+
"bin/",
|
|
37
|
+
"config/",
|
|
38
|
+
"utils/"
|
|
27
39
|
],
|
|
28
|
-
"preferGlobal": true,
|
|
29
|
-
"engines": {
|
|
30
|
-
"node": ">=20.0.0",
|
|
31
|
-
"npm": ">=10.0.0"
|
|
32
|
-
},
|
|
33
40
|
"scripts": {
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
|
|
39
|
-
"type-check": "tsc --noEmit",
|
|
40
|
-
"format": "prettier --write .",
|
|
41
|
-
"test": "npm run test --prefix sdk/typescript && npm run test --prefix plugins/openclaw",
|
|
42
|
-
"test:ui": "vitest --ui",
|
|
43
|
-
"test:coverage": "vitest --coverage",
|
|
44
|
-
"clean": "rm -rf .next dist build node_modules",
|
|
45
|
-
"clean:cache": "rm -rf .next",
|
|
46
|
-
"analyze": "ANALYZE=true next build"
|
|
41
|
+
"postinstall": "node postinstall.js"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
47
45
|
},
|
|
48
46
|
"dependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"next": "^16.3.8",
|
|
53
|
-
"react": "19.0.0",
|
|
54
|
-
"react-dom": "19.0.0",
|
|
55
|
-
"recharts": "^3.10.1",
|
|
56
|
-
"tailwind-merge": "^2.5.5",
|
|
57
|
-
"tailwindcss-animate": "^1.0.7"
|
|
47
|
+
"chalk": "^5.3.0",
|
|
48
|
+
"dotenv": "^16.4.5",
|
|
49
|
+
"yargs": "^17.7.2"
|
|
58
50
|
},
|
|
59
51
|
"devDependencies": {
|
|
60
|
-
"@
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"@typescript-eslint/parser": "^7.0.0",
|
|
66
|
-
"autoprefixer": "^10.6.1",
|
|
67
|
-
"eslint": "^8.56.0",
|
|
68
|
-
"eslint-config-next": "15.3.4",
|
|
69
|
-
"postcss": "^8.5.13",
|
|
70
|
-
"postcss-import": "^16.2.0",
|
|
71
|
-
"prettier": "^3.2.5",
|
|
72
|
-
"tailwindcss": "^4.3.3",
|
|
73
|
-
"tailwindcss-v3": "npm:tailwindcss@^3.4.17",
|
|
74
|
-
"typescript": "^5.4.2",
|
|
75
|
-
"vitest": "^1.2.0"
|
|
52
|
+
"@types/node": "^22.0.0"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public",
|
|
56
|
+
"registry": "https://registry.npmjs.org/"
|
|
76
57
|
}
|
|
77
58
|
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* xithead postinstall — auto-installs Python proxy dependencies
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const { spawnSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
function findPython() {
|
|
10
|
+
for (const cmd of ['python', 'python3', 'py']) {
|
|
11
|
+
const r = spawnSync(cmd, ['--version'], { stdio: 'pipe' });
|
|
12
|
+
if (r.status === 0) return cmd;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const py = findPython();
|
|
18
|
+
if (!py) {
|
|
19
|
+
console.log('[xithead] Python nicht gefunden — überspringe Proxy-Setup.');
|
|
20
|
+
console.log(' Installiere Python von https://python.org und führe dann aus:');
|
|
21
|
+
console.log(' pip install "xithead[proxy]"');
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Check if proxy deps already installed
|
|
26
|
+
const check = spawnSync(py, ['-c', 'import fastapi, uvicorn, httpx'], { stdio: 'pipe' });
|
|
27
|
+
if (check.status === 0) {
|
|
28
|
+
console.log('[xithead] Proxy-Abhängigkeiten bereits installiert ✓');
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log('[xithead] Installiere xithead[proxy] (fastapi + uvicorn + httpx)...');
|
|
33
|
+
const result = spawnSync(
|
|
34
|
+
py, ['-m', 'pip', 'install', '-q', '--upgrade', 'xithead[proxy]'],
|
|
35
|
+
{ stdio: 'inherit' }
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (result.status === 0) {
|
|
39
|
+
console.log('[xithead] Proxy-Abhängigkeiten erfolgreich installiert ✓');
|
|
40
|
+
} else {
|
|
41
|
+
console.log('[xithead] Hinweis: Proxy-Installation fehlgeschlagen.');
|
|
42
|
+
console.log(' Manuell: pip install "xithead[proxy]"');
|
|
43
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
Copyright 2025 Headroom Contributors
|
|
179
|
-
|
|
180
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
-
you may not use this file except in compliance with the License.
|
|
182
|
-
You may obtain a copy of the License at
|
|
183
|
-
|
|
184
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
-
|
|
186
|
-
Unless required by applicable law or agreed to in writing, software
|
|
187
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
-
See the License for the specific language governing permissions and
|
|
190
|
-
limitations under the License.
|
package/README.md
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# xtream-head
|
|
2
|
-
|
|
3
|
-
**Lokaler Claude Code Proxy** von [Xtream-ITSolutions UG](https://xtream-itsolutions.com) — setzt sich zwischen Claude Code und die Anthropic API, maximiert den Prompt Cache und reduziert Token-Kosten bis zu **88%**.
|
|
4
|
-
|
|
5
|
-
Dashboard läuft lokal auf `localhost:8787/dashboard` — deine Stats, deine Daten.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
### Option 1: Proxy (Python, empfohlen für Claude Code)
|
|
12
|
-
|
|
13
|
-
Der Proxy ist das Python-Paket. Er startet auf `http://127.0.0.1:8787` und leitet Anfragen an `https://api.anthropic.com` weiter.
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pip install "xtream-head[proxy]" # aus PyPI, sobald veröffentlicht
|
|
17
|
-
# oder aus dem Repo:
|
|
18
|
-
pip install -e ".[proxy]"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Proxy starten und Claude Code direkt darüber laufen lassen:
|
|
22
|
-
```bash
|
|
23
|
-
xithead wrap claude
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Oder den Proxy separat starten und die Umgebungsvariable selbst setzen:
|
|
27
|
-
```bash
|
|
28
|
-
xithead proxy --port 8787
|
|
29
|
-
export ANTHROPIC_BASE_URL=http://127.0.0.1:8787 # Windows PowerShell: $env:ANTHROPIC_BASE_URL='http://127.0.0.1:8787'
|
|
30
|
-
claude
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Option 2: Dashboard (npm)
|
|
34
|
-
|
|
35
|
-
Das npm-Paket startet nur das Next.js-Dashboard. Es startet keinen Proxy.
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm install -g github:xtream-itsolutions/xithead
|
|
39
|
-
xithead # Dashboard auf http://localhost:8787/dashboard
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
> **Hinweis:** Beide Pakete stellen einen Befehl `xithead` bereit. Nicht beide gleichzeitig installieren, und beide Dienste nicht gleichzeitig auf Port 8787 starten.
|
|
43
|
-
|
|
44
|
-
### Option 3: Skript-Installation (Windows)
|
|
45
|
-
|
|
46
|
-
```powershell
|
|
47
|
-
iex (irm https://raw.githubusercontent.com/xtream-itsolutions/xithead/main/xithead.ps1)
|
|
48
|
-
xithead
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### VS Code: Claude Code Extension über den Proxy betreiben
|
|
52
|
-
|
|
53
|
-
Die Extension liest dieselbe Claude-Code-Konfiguration wie die CLI. Die Umgebungsvariable deshalb in `~/.claude/settings.json` eintragen, nicht nur in der Shell:
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{
|
|
57
|
-
"env": {
|
|
58
|
-
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8787"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Danach:
|
|
64
|
-
1. Proxy starten: `xithead proxy --port 8787`.
|
|
65
|
-
2. VS Code komplett neu starten, damit die Extension die Einstellung übernimmt.
|
|
66
|
-
3. Im Claude-Code-Panel eine Nachricht senden.
|
|
67
|
-
|
|
68
|
-
Ist der Proxy nicht gestartet, schlagen Anfragen fehl. Dann den `env`-Eintrag entfernen, damit Claude Code wieder direkt mit der Anthropic-API spricht.
|
|
69
|
-
|
|
70
|
-
Vollständige Anleitung für Windows, macOS und Linux: **[xtream-head.com/installation](https://xtream-head.com/installation)**
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Befehle
|
|
75
|
-
|
|
76
|
-
| Befehl | Funktion |
|
|
77
|
-
|--------|----------|
|
|
78
|
-
| `xtream-head` | Proxy + Claude Code starten |
|
|
79
|
-
| `xtream-head-dashboard` | Dashboard im Browser öffnen |
|
|
80
|
-
| `xtream-head-stats` | Einsparungen in der Konsole anzeigen |
|
|
81
|
-
| `xtream-head-update` | Alles aktualisieren |
|
|
82
|
-
| `xtream-head-doctor` | System-Diagnose |
|
|
83
|
-
| `headroom privacy doctor` | Datenschutz- und Deployment-Sicherheit prüfen |
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Was es macht
|
|
88
|
-
|
|
89
|
-
- **Cache-Control Normalisierung** — Verhindert HTTP 400 Fehler
|
|
90
|
-
- **Lossless Compression** — ANSI-Strip, Run-Collapse, Diff-Strip, Line-Truncation
|
|
91
|
-
- **Message Dedup** — Identische Nachrichten werden eliminiert
|
|
92
|
-
- **Context Trim** — Automatische Kürzung bei Token-Overflow
|
|
93
|
-
- **Lokales Dashboard** — Echtzeit-Stats auf `localhost:8787/dashboard`
|
|
94
|
-
- **Policy Engine** — Provider-, Modell- und Projektregeln für sichere Kompression
|
|
95
|
-
- **Replay-Fixtures** — anonymisierte Requests reproduzierbar analysieren
|
|
96
|
-
- **Quality Score** — Einsparung, Latenz, Struktur und Zuverlässigkeit gemeinsam bewerten
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Links
|
|
101
|
-
|
|
102
|
-
- Website: [xtream-head.com](https://xtream-head.com)
|
|
103
|
-
- Discord: [discord.gg/xtream-itsolutions](https://discord.gg/xtream-itsolutions)
|
|
104
|
-
- Unternehmen: [xtream-itsolutions.com](https://xtream-itsolutions.com)
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
Apache 2.0 License · © 2026 Xtream-ITSolutions UG
|
package/app/api/config/route.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from "next/server"
|
|
2
|
-
|
|
3
|
-
let config = {
|
|
4
|
-
model: "claude-sonnet-5",
|
|
5
|
-
theme: "dark",
|
|
6
|
-
autoUpdate: true,
|
|
7
|
-
cacheEnabled: true,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export async function GET() {
|
|
11
|
-
return NextResponse.json(config)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export async function POST(request: Request) {
|
|
15
|
-
try {
|
|
16
|
-
const body = await request.json()
|
|
17
|
-
config = { ...config, ...body }
|
|
18
|
-
return NextResponse.json({ success: true, config })
|
|
19
|
-
} catch (error) {
|
|
20
|
-
return NextResponse.json({ error: "Invalid request" }, { status: 400 })
|
|
21
|
-
}
|
|
22
|
-
}
|