@himanshu806/ccproxy 0.1.0
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/LICENSE +28 -0
- package/README.md +33 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +202 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +43 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +138 -0
- package/dist/config.js.map +1 -0
- package/dist/converter.d.ts +21 -0
- package/dist/converter.d.ts.map +1 -0
- package/dist/converter.js +159 -0
- package/dist/converter.js.map +1 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +73 -0
- package/dist/logger.js.map +1 -0
- package/dist/providers/gemini.d.ts +22 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +45 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/index.d.ts +4 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +4 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/ollama.d.ts +22 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +44 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/openai.d.ts +22 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +38 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +73 -0
- package/dist/server.js.map +1 -0
- package/dist/translator.d.ts +3 -0
- package/dist/translator.d.ts.map +1 -0
- package/dist/translator.js +155 -0
- package/dist/translator.js.map +1 -0
- package/dist/types.d.ts +108 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export interface AnthropicContentBlockText {
|
|
2
|
+
type: "text";
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AnthropicContentBlockImage {
|
|
6
|
+
type: "image";
|
|
7
|
+
source: {
|
|
8
|
+
type: "base64" | "url";
|
|
9
|
+
media_type?: string;
|
|
10
|
+
data?: string;
|
|
11
|
+
url?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface AnthropicContentBlockToolUse {
|
|
15
|
+
type: "tool_use";
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
input: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface AnthropicContentBlockToolResult {
|
|
21
|
+
type: "tool_result";
|
|
22
|
+
tool_use_id: string;
|
|
23
|
+
content: string | AnthropicContentBlock[];
|
|
24
|
+
}
|
|
25
|
+
export type AnthropicContentBlock = AnthropicContentBlockText | AnthropicContentBlockImage | AnthropicContentBlockToolUse | AnthropicContentBlockToolResult;
|
|
26
|
+
export interface AnthropicMessage {
|
|
27
|
+
role: "user" | "assistant";
|
|
28
|
+
content: string | AnthropicContentBlock[];
|
|
29
|
+
}
|
|
30
|
+
export interface AnthropicTool {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
input_schema: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface AnthropicRequest {
|
|
36
|
+
model: string;
|
|
37
|
+
messages: AnthropicMessage[];
|
|
38
|
+
system?: string | Array<{
|
|
39
|
+
type: string;
|
|
40
|
+
text: string;
|
|
41
|
+
}>;
|
|
42
|
+
max_tokens?: number;
|
|
43
|
+
temperature?: number;
|
|
44
|
+
top_p?: number;
|
|
45
|
+
stream?: boolean;
|
|
46
|
+
tools?: AnthropicTool[];
|
|
47
|
+
tool_choice?: {
|
|
48
|
+
type: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
};
|
|
51
|
+
stop_sequences?: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface OpenAIContentPartText {
|
|
54
|
+
type: "text";
|
|
55
|
+
text: string;
|
|
56
|
+
}
|
|
57
|
+
export interface OpenAIContentPartImage {
|
|
58
|
+
type: "image_url";
|
|
59
|
+
image_url: {
|
|
60
|
+
url: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export type OpenAIContentPart = OpenAIContentPartText | OpenAIContentPartImage;
|
|
64
|
+
export interface OpenAIToolCall {
|
|
65
|
+
id: string;
|
|
66
|
+
type: "function";
|
|
67
|
+
function: {
|
|
68
|
+
name: string;
|
|
69
|
+
arguments: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export interface OpenAIMessage {
|
|
73
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
74
|
+
content: string | OpenAIContentPart[] | null;
|
|
75
|
+
tool_calls?: OpenAIToolCall[];
|
|
76
|
+
tool_call_id?: string;
|
|
77
|
+
name?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface OpenAITool {
|
|
80
|
+
type: "function";
|
|
81
|
+
function: {
|
|
82
|
+
name: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
parameters: Record<string, unknown>;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface OpenAIRequest {
|
|
88
|
+
model: string;
|
|
89
|
+
messages: OpenAIMessage[];
|
|
90
|
+
max_tokens?: number;
|
|
91
|
+
temperature?: number;
|
|
92
|
+
top_p?: number;
|
|
93
|
+
stream?: boolean;
|
|
94
|
+
tools?: OpenAITool[];
|
|
95
|
+
tool_choice?: "auto" | "none" | "required" | {
|
|
96
|
+
type: "function";
|
|
97
|
+
function: {
|
|
98
|
+
name: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
stop?: string[];
|
|
102
|
+
}
|
|
103
|
+
export interface TranslatedRequest {
|
|
104
|
+
provider: "openai" | "gemini" | "ollama";
|
|
105
|
+
model: string;
|
|
106
|
+
translatedRequest: OpenAIRequest;
|
|
107
|
+
}
|
|
108
|
+
//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UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAC9F,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAID,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,aAAa,CAAC;CAClC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,uBAAuB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@himanshu806/ccproxy",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Use Claude Code with any AI provider: OpenAI, Gemini, or Ollama",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/server.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ccproxy": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsx watch src/cli.ts",
|
|
13
|
+
"start": "node dist/cli.js",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"claude",
|
|
18
|
+
"anthropic",
|
|
19
|
+
"openai",
|
|
20
|
+
"gemini",
|
|
21
|
+
"ollama",
|
|
22
|
+
"proxy",
|
|
23
|
+
"claude-code"
|
|
24
|
+
],
|
|
25
|
+
"license": "BSD-3-Clause",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"chalk": "^5.6.2",
|
|
28
|
+
"dotenv": "^16.4.5",
|
|
29
|
+
"fastify": "^4.28.0",
|
|
30
|
+
"figlet": "^1.10.0",
|
|
31
|
+
"openai": "^4.77.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^22.0.0",
|
|
35
|
+
"tsx": "^4.19.0",
|
|
36
|
+
"typescript": "^5.7.0"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=22.0.0"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE"
|
|
45
|
+
],
|
|
46
|
+
"homepage": "https://github.com/himasnhu-at/ccproxy#readme",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/himasnhu-at/ccproxy/issues"
|
|
49
|
+
},
|
|
50
|
+
"author": {
|
|
51
|
+
"name": "Himanshu",
|
|
52
|
+
"email": "hyattherate2005@gmail.com",
|
|
53
|
+
"url": "https://himanshuat.com"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/himasnhu-at/mockserver.git"
|
|
58
|
+
}
|
|
59
|
+
}
|