ccproxy-api 0.1.5__py3-none-any.whl → 0.1.7__py3-none-any.whl
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.
- ccproxy/_version.py +2 -2
- ccproxy/adapters/codex/__init__.py +11 -0
- ccproxy/adapters/openai/models.py +1 -1
- ccproxy/adapters/openai/response_adapter.py +355 -0
- ccproxy/adapters/openai/response_models.py +178 -0
- ccproxy/api/app.py +31 -3
- ccproxy/api/dependencies.py +1 -8
- ccproxy/api/middleware/errors.py +15 -7
- ccproxy/api/routes/codex.py +1251 -0
- ccproxy/api/routes/health.py +228 -3
- ccproxy/auth/openai/__init__.py +13 -0
- ccproxy/auth/openai/credentials.py +166 -0
- ccproxy/auth/openai/oauth_client.py +334 -0
- ccproxy/auth/openai/storage.py +184 -0
- ccproxy/claude_sdk/options.py +1 -1
- ccproxy/cli/commands/auth.py +398 -1
- ccproxy/cli/commands/serve.py +3 -1
- ccproxy/config/claude.py +1 -1
- ccproxy/config/codex.py +100 -0
- ccproxy/config/scheduler.py +8 -8
- ccproxy/config/settings.py +19 -0
- ccproxy/core/codex_transformers.py +389 -0
- ccproxy/core/http_transformers.py +153 -2
- ccproxy/data/claude_headers_fallback.json +37 -0
- ccproxy/data/codex_headers_fallback.json +14 -0
- ccproxy/models/detection.py +82 -0
- ccproxy/models/requests.py +22 -0
- ccproxy/models/responses.py +16 -0
- ccproxy/scheduler/manager.py +2 -2
- ccproxy/scheduler/tasks.py +105 -65
- ccproxy/services/claude_detection_service.py +7 -33
- ccproxy/services/codex_detection_service.py +252 -0
- ccproxy/services/proxy_service.py +530 -0
- ccproxy/utils/model_mapping.py +7 -5
- ccproxy/utils/startup_helpers.py +205 -12
- ccproxy/utils/version_checker.py +6 -0
- ccproxy_api-0.1.7.dist-info/METADATA +615 -0
- {ccproxy_api-0.1.5.dist-info → ccproxy_api-0.1.7.dist-info}/RECORD +41 -28
- ccproxy_api-0.1.5.dist-info/METADATA +0 -396
- {ccproxy_api-0.1.5.dist-info → ccproxy_api-0.1.7.dist-info}/WHEEL +0 -0
- {ccproxy_api-0.1.5.dist-info → ccproxy_api-0.1.7.dist-info}/entry_points.txt +0 -0
- {ccproxy_api-0.1.5.dist-info → ccproxy_api-0.1.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
ccproxy/__init__.py,sha256=VrtzUTUA8MwpYqFJAiwKLPxRdMRc7UOzFi2VB_1W9qw,62
|
|
2
2
|
ccproxy/__main__.py,sha256=kcejcfzAaMnFiSxEiVtNl-_TwynpntkupRxqG5XR15s,116
|
|
3
|
-
ccproxy/_version.py,sha256=
|
|
3
|
+
ccproxy/_version.py,sha256=W_EoL8cAL4KhujvbYWEpb9NqRLbbrH0T024lJvRRWHI,511
|
|
4
4
|
ccproxy/adapters/__init__.py,sha256=CMr5MPIFigfazoXfhyD2eLqBrutzaSzBaEi8u2i9xJQ,206
|
|
5
5
|
ccproxy/adapters/base.py,sha256=aufx8ho9LhF0kmTsCvw1a9K3lk5YyYymJV8h_wt5TpU,2191
|
|
6
|
+
ccproxy/adapters/codex/__init__.py,sha256=gwpdJeOfwthwnQWuoHmrOGEY-ntTOF5T6sRY97Si2ks,235
|
|
6
7
|
ccproxy/adapters/openai/__init__.py,sha256=CEOtyALpgaq6XT6upZKt0u_ilvnXIyH9K2hFXZJ-hOY,1063
|
|
7
8
|
ccproxy/adapters/openai/adapter.py,sha256=8g9jBtEET_NEZKt27prw_Go9WMS_BJUoxyvhoMk74-g,37960
|
|
8
|
-
ccproxy/adapters/openai/models.py,sha256=
|
|
9
|
+
ccproxy/adapters/openai/models.py,sha256=He63JFWe_DZAYbGVy69b4EE9ihQ8j2DxNjr4dmz30N4,11659
|
|
10
|
+
ccproxy/adapters/openai/response_adapter.py,sha256=2X_sMpc03gQkz-ckGcPUKkldv3U9g9v5KFY7owncf1Y,14367
|
|
11
|
+
ccproxy/adapters/openai/response_models.py,sha256=NunShPmyHPhGrfU0az3k4dUQbYGMt1SfjwU0mRQAWpQ,4715
|
|
9
12
|
ccproxy/adapters/openai/streaming.py,sha256=-nhKVPqCfAlV8PDi5-q3dVyslCpAu5DHh0BCrBfb9GU,23219
|
|
10
13
|
ccproxy/api/__init__.py,sha256=_u4wpzvN4Y0qS4CTaGp8nD8ZopB0HeFxnIIw9GYjvvk,527
|
|
11
|
-
ccproxy/api/app.py,sha256=
|
|
12
|
-
ccproxy/api/dependencies.py,sha256
|
|
14
|
+
ccproxy/api/app.py,sha256=AC24so4V9Afoqfapy5cJ4nGOMbpJtD2Kt2yK-HDClxo,12814
|
|
15
|
+
ccproxy/api/dependencies.py,sha256=DmNPmV0IO-kqF_IewDHecYKJfsM0NwXQU0Pl6eZlxl8,6621
|
|
13
16
|
ccproxy/api/responses.py,sha256=97TUQ8KF_eKLBRWgAnziGZBjBfJtY13cjgM_o0k_lDc,3062
|
|
14
17
|
ccproxy/api/middleware/__init__.py,sha256=S887PXY40Tnb0IFGei4Sgs7sygkcoT0IEOciOO7IDBc,284
|
|
15
18
|
ccproxy/api/middleware/auth.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
19
|
ccproxy/api/middleware/cors.py,sha256=u8bnWmBXRG9J2etbQdNsQOTIQY6PFWawk2Oa0Ei1x3s,1666
|
|
17
|
-
ccproxy/api/middleware/errors.py,sha256=
|
|
20
|
+
ccproxy/api/middleware/errors.py,sha256=X5CcAjwJPV5aMjN7dlGejoglmBH8cSGArCp7VTcbxrA,23276
|
|
18
21
|
ccproxy/api/middleware/headers.py,sha256=zGhF3F11TKeb3zY5qzblU3Sdwx1MSlqm2QSOqtVfpoY,1775
|
|
19
22
|
ccproxy/api/middleware/logging.py,sha256=fGHacI_vRtQs9LpKpCebVUpo7bSC6qy4hbqftmLe_Uk,7353
|
|
20
23
|
ccproxy/api/middleware/request_content_logging.py,sha256=aIH1G9kjNr4-O5IFoisI9fO93rPePVWBQJM4wX1NCnY,10333
|
|
@@ -22,7 +25,8 @@ ccproxy/api/middleware/request_id.py,sha256=OOZh63FYP_JY3olZNzgzVdPFZUJFT_KerZxY
|
|
|
22
25
|
ccproxy/api/middleware/server_header.py,sha256=9A3c7L12CFkQftMOZwB5JzqocGWymuV8AT_u_Y2s9RA,2329
|
|
23
26
|
ccproxy/api/routes/__init__.py,sha256=xXoslArg915ZTmN2ITQ-i3iO7fu8ZkQAMrSgC41U5oA,664
|
|
24
27
|
ccproxy/api/routes/claude.py,sha256=lERvCRFiHfhfQC6uYaUSRwplSRvUbn3of0tACYib4x0,15079
|
|
25
|
-
ccproxy/api/routes/
|
|
28
|
+
ccproxy/api/routes/codex.py,sha256=AnHf01bgPxb3sQdZDtcgmFw6mHnX6-1WOtBcTUAsKXA,67396
|
|
29
|
+
ccproxy/api/routes/health.py,sha256=TWs7ipKDynwfG3Cj5X8BMoglyTP9zEPz5cDq1-vDiHQ,26518
|
|
26
30
|
ccproxy/api/routes/mcp.py,sha256=-EVGid0uNOWeXP4w8F_hKUp1odkNnFXPHPmaOGC0UzQ,5389
|
|
27
31
|
ccproxy/api/routes/metrics.py,sha256=MHG2nEGu3amrU6zJCuH2RktM8kg2EFxu4xNOFCzXMn4,40813
|
|
28
32
|
ccproxy/api/routes/permissions.py,sha256=dvbWORmmAce7VZWlZPvchTCO9F6fauavmSbs8hUltKE,6231
|
|
@@ -44,6 +48,10 @@ ccproxy/auth/oauth/__init__.py,sha256=PEymCot9_oIj2mKFIyfmIlznoKwoBuSKqfRvH9k_QR
|
|
|
44
48
|
ccproxy/auth/oauth/models.py,sha256=CIgzXpyf5PY8vnO8jkv3cfr1W9rkT5qtkz_u2xGabV4,2007
|
|
45
49
|
ccproxy/auth/oauth/routes.py,sha256=9sWaib49v5MFv_FFsnlgTXqgwvGprWWwpJzrSihKaks,13598
|
|
46
50
|
ccproxy/auth/oauth/storage.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
|
+
ccproxy/auth/openai/__init__.py,sha256=Af7h3n3xGmCKO7FsSA1sdNBWfjajd5l5ccMArn4U8E8,328
|
|
52
|
+
ccproxy/auth/openai/credentials.py,sha256=Jz8PA9OFfBZXh-DSARI-vM6buNtci5ObmFUNb5MqIko,6088
|
|
53
|
+
ccproxy/auth/openai/oauth_client.py,sha256=Wen_FTN0Lo2BMydQ23LipJZHDVl4RToXED5G4Vzcixc,12146
|
|
54
|
+
ccproxy/auth/openai/storage.py,sha256=8GwCnw29_zTVL7LMqfX2KsszcEFVo9nT9TCbGsBEexQ,6433
|
|
47
55
|
ccproxy/auth/storage/__init__.py,sha256=5thfvXhc8HGJblQWMiG6ZPl594RpbTGdAgyAlpAe1TI,324
|
|
48
56
|
ccproxy/auth/storage/base.py,sha256=Gw20tabOKTwey6YrOm09Bxu-MYJuMIrQULLJT6RQ07E,1357
|
|
49
57
|
ccproxy/auth/storage/json_file.py,sha256=iZBFCJ5EsZeFtlT7ORTXcEdAvMADIaDTXUPEBSjMcr0,5027
|
|
@@ -54,7 +62,7 @@ ccproxy/claude_sdk/converter.py,sha256=GeU7AzbzK1ltaiUEr60mG4VYaSup95Z6OxVSG9Pu0
|
|
|
54
62
|
ccproxy/claude_sdk/exceptions.py,sha256=LYUmy4K4TnrOixINScswc-Xg31gZJbbFimZgw9hIfy4,428
|
|
55
63
|
ccproxy/claude_sdk/manager.py,sha256=UuUhFNSF6UTaonmllHzwORwrXjcv1k_DwkHmsYJUhqY,7319
|
|
56
64
|
ccproxy/claude_sdk/message_queue.py,sha256=V2BU2Wdsdfb-TyfvOzYMszeEcdcBmVkiqB52IjS_oM8,11136
|
|
57
|
-
ccproxy/claude_sdk/options.py,sha256=
|
|
65
|
+
ccproxy/claude_sdk/options.py,sha256=NVyQc7_CxhC2UsavNtrLZ6pFIVwHaHv6euyc44TFYj8,7097
|
|
58
66
|
ccproxy/claude_sdk/parser.py,sha256=1LcZOTkaKLSxZO_iVIvpZq44vUjApvMIA8Wlv61V6Jo,7193
|
|
59
67
|
ccproxy/claude_sdk/session_client.py,sha256=ipKvWyFx7nCI4n1VHbCsqbSjo5HdMC1P2lrX8fkTy8g,20052
|
|
60
68
|
ccproxy/claude_sdk/session_pool.py,sha256=BX0I4TdtgfVDEJozjmoSQTls24s-3KfFNTSSAgmA9LM,23993
|
|
@@ -65,9 +73,9 @@ ccproxy/cli/__init__.py,sha256=_vISKEqzAsAYrTZ-j9ScxTUtFZp3RVRbIvGpCcu--SU,262
|
|
|
65
73
|
ccproxy/cli/helpers.py,sha256=LHGh5ZSywPUY61XVaSD5mx2eaIF4bi8hzbdMCJ0YRrQ,3814
|
|
66
74
|
ccproxy/cli/main.py,sha256=QLdSbSm3PjvwluL6WO7kpe8S7qrgsw2VjMR84aZ2fsg,2452
|
|
67
75
|
ccproxy/cli/commands/__init__.py,sha256=eWugiC37ualVtsTazu7GBCV7kZ12xkAnTUztjV7kVao,200
|
|
68
|
-
ccproxy/cli/commands/auth.py,sha256=
|
|
76
|
+
ccproxy/cli/commands/auth.py,sha256=oAA37cGo6SgGtunDaqf5n8QgRtmvvEajF8bHtD8c-nI,34987
|
|
69
77
|
ccproxy/cli/commands/permission_handler.py,sha256=rdPxXCZ3pK6a93eKED2XFNIwtnNcTW5XjM-X7edBcb0,18463
|
|
70
|
-
ccproxy/cli/commands/serve.py,sha256=
|
|
78
|
+
ccproxy/cli/commands/serve.py,sha256=ZNYrODXcJaHbrT8Vv7vi8bNKXKe7f81RSYveroD-Hh0,32951
|
|
71
79
|
ccproxy/cli/commands/config/__init__.py,sha256=uX8VewtrMu5X8VAx5ym1slwNtlICDBEs3S1HfoFe5Qo,376
|
|
72
80
|
ccproxy/cli/commands/config/commands.py,sha256=ukAr55NLFTg67f5czpjbuz_Ap_mwFIMIfMGHeXv_E5c,28917
|
|
73
81
|
ccproxy/cli/commands/config/schema_commands.py,sha256=ZSuK_Q1bWp8WUOSbkuwKz_4TwrxkRsA6MOt_-y1eiVs,4218
|
|
@@ -81,24 +89,26 @@ ccproxy/cli/options/security_options.py,sha256=95TfENdeAsDMes7SH39mQJERgrqoL4jZE
|
|
|
81
89
|
ccproxy/cli/options/server_options.py,sha256=y37dtZGWuuYcDOn92zSzKwblnTgq65ZJJk2fWBA__s4,1935
|
|
82
90
|
ccproxy/config/__init__.py,sha256=OGN54wL_XB-vP-g603NhqsSxYvKEXvBXVuEIxLV_tb4,891
|
|
83
91
|
ccproxy/config/auth.py,sha256=CDc5qiexq4jH3Ve39tnL1Vn5c5bOUBWUdi7j4VLwewU,4653
|
|
84
|
-
ccproxy/config/claude.py,sha256=
|
|
92
|
+
ccproxy/config/claude.py,sha256=p_J9khK_aD6nQVQDeKUpU7JFaAqEduP_wemKgZqjpt4,12486
|
|
93
|
+
ccproxy/config/codex.py,sha256=zzYwZZeIZgcYSxyqv97oOUEGBf0Pqv_ZNQoMWoJ8lF8,3145
|
|
85
94
|
ccproxy/config/cors.py,sha256=eNxrNuPN7Ujh9_2fIWu6kmOIeYNuqn0NTuCsBYvctFM,2505
|
|
86
95
|
ccproxy/config/discovery.py,sha256=lz5L0YcyVruZnXOxEXOD_4zg0k4W-woOGML9zwpmexQ,2487
|
|
87
96
|
ccproxy/config/docker_settings.py,sha256=5D8eBSyWActgBGE7cIb4HObqlvE-7jxylmUBn5UxLM4,8390
|
|
88
97
|
ccproxy/config/observability.py,sha256=5AwQFEFxJLUStGP5gjL_5i8Hk8KdrXKY7ocITYg8jZQ,5466
|
|
89
98
|
ccproxy/config/pricing.py,sha256=RzsNQHYmv5P-BcRDV4GSkSIDImFIFEEC7roFu5jeocE,2613
|
|
90
99
|
ccproxy/config/reverse_proxy.py,sha256=hep4ubV7-4ZgdO1_WqY56b5yrYyHCdQgYayUHKH3tfo,866
|
|
91
|
-
ccproxy/config/scheduler.py,sha256=
|
|
100
|
+
ccproxy/config/scheduler.py,sha256=drgZt990HtDeR8l6iak7H08-fa9N1X-K3f6yn-92TEg,3170
|
|
92
101
|
ccproxy/config/security.py,sha256=luNy1J6xXSKPRjAVTmF1mqSpN4h0I_1CllBJfaYbq0Q,493
|
|
93
102
|
ccproxy/config/server.py,sha256=71Ih6huVn52demV6jNrixM8jqXVqfFrBpIvWIlmhlww,2527
|
|
94
|
-
ccproxy/config/settings.py,sha256=
|
|
103
|
+
ccproxy/config/settings.py,sha256=0yht-uCZdEfzG2I1YYJ_YiXCTO9yv0sh1iTe8N4GLBw,19052
|
|
95
104
|
ccproxy/config/validators.py,sha256=EciRiEF7qGBcDp2Ms10VXyfAWXY_2uPPglvGh7EVLDs,5754
|
|
96
105
|
ccproxy/core/__init__.py,sha256=ZreOdlUlCn7R5GlS3EdpvIj5fO9sySbQKnuR8o6vwXI,6400
|
|
97
106
|
ccproxy/core/async_utils.py,sha256=slRQkIGctjZb6ZxridoJscFKVbyW2SYREieQjkpP_e8,19855
|
|
107
|
+
ccproxy/core/codex_transformers.py,sha256=4awSlBkefsF4ouMWIj3ZR8mbO6ccCddaGTyxOKXzEaQ,15182
|
|
98
108
|
ccproxy/core/constants.py,sha256=mmkcOfKNnvu3h5paZ6GL72ecAK4XdBI4tXlmgImGyzI,2735
|
|
99
109
|
ccproxy/core/errors.py,sha256=gP1rh-k-KpE5OcVbFcdMdZSmDshvcoXdbVynIx864gc,8459
|
|
100
110
|
ccproxy/core/http.py,sha256=pj3UM9TDL13_sU0ULGuA2wvVg58uxOCy-ib3zugjelo,9317
|
|
101
|
-
ccproxy/core/http_transformers.py,sha256=
|
|
111
|
+
ccproxy/core/http_transformers.py,sha256=LF8LZRwklJoGMtx9_JhxZkFAfNf-V6n0hL9bNcmmFmc,31216
|
|
102
112
|
ccproxy/core/interfaces.py,sha256=zzucgNTvui7fGQ8vjLzCba-itJZh0Fs6GrDAZNJfGXo,6366
|
|
103
113
|
ccproxy/core/logging.py,sha256=xwWsFTqGLrGrjQzgV2MphrwHg4i8YDW591xlhUGl7l4,10171
|
|
104
114
|
ccproxy/core/middleware.py,sha256=libv7wo-y9nni9hp7GCkYUKlIKihAwG0iHvjcv_RTs8,3355
|
|
@@ -107,6 +117,8 @@ ccproxy/core/system.py,sha256=91rMtlRtY4yxSsnPV5qZJaXHNFzvcrRZ1nQwS4CwG68,1019
|
|
|
107
117
|
ccproxy/core/transformers.py,sha256=BpOweWwpuUKEsLe32zqqTN0iNPRVXjyAoW1jBPSO0C8,7884
|
|
108
118
|
ccproxy/core/types.py,sha256=kGRMzb6VI5KWa3aFKWgQ3gChqdHPrPoOyZ0QPT1m18E,3554
|
|
109
119
|
ccproxy/core/validators.py,sha256=k2z71lz-zKhRdtx3tYgJllqFnEcQ-eivj1kf3aVej0s,7367
|
|
120
|
+
ccproxy/data/claude_headers_fallback.json,sha256=AIlN6-LENIo05idVAET07iE7170POXuB2Li-70leJ4c,30681
|
|
121
|
+
ccproxy/data/codex_headers_fallback.json,sha256=-h4vNPGV-toEucQstEd_eXHY1OM2cNoNYREcujUGOH4,24560
|
|
110
122
|
ccproxy/docker/__init__.py,sha256=gO9FJepIWneXPANgsAJKx_VL9rt7pcX3hbRcwnSyzJk,1833
|
|
111
123
|
ccproxy/docker/adapter.py,sha256=P-GeLVu5hl4oMHQrQJU3AHnUxrps-iUd06r7IVnncoY,21176
|
|
112
124
|
ccproxy/docker/docker_path.py,sha256=U_Di1bJDxDZNHW0cxGL31PD6RGKS9Sngs6_D7burmd0,6419
|
|
@@ -117,12 +129,12 @@ ccproxy/docker/stream_process.py,sha256=XahXegGG6B-7RsZAb9J8OA7sz7xi8CmRzEI4vBJL
|
|
|
117
129
|
ccproxy/docker/validators.py,sha256=OY-dkU88CLIeMBfv4P5QoVB7miQ8BD7kIgaMHxF7TsU,5764
|
|
118
130
|
ccproxy/models/__init__.py,sha256=yaz9lC0roh0u7C33rHrGW46lrwbyyAa_evpAlA5BzYw,3548
|
|
119
131
|
ccproxy/models/claude_sdk.py,sha256=T-6HpAPe2a17sd27HE7ttFENh2JxwrFrnGBwMwDwovs,15522
|
|
120
|
-
ccproxy/models/detection.py,sha256
|
|
132
|
+
ccproxy/models/detection.py,sha256=LRlimMQwPjrxczER7liospxkcskhLS5QiJS7EStEaHU,7082
|
|
121
133
|
ccproxy/models/errors.py,sha256=B2rbL-17ZI9emDOca2A2fLOcH1-_77t_xqDmiPf6fgY,1329
|
|
122
134
|
ccproxy/models/messages.py,sha256=halc96Yxx3R5Xa9F5Q53iFZs0MJMDRfAA0fSxaij51U,8013
|
|
123
135
|
ccproxy/models/permissions.py,sha256=uhlzHc56rDzekjQMN8ITPCrh-0lamcgzTwx1OA2y67w,3612
|
|
124
|
-
ccproxy/models/requests.py,sha256=
|
|
125
|
-
ccproxy/models/responses.py,sha256=
|
|
136
|
+
ccproxy/models/requests.py,sha256=iUVHNMs5tCnEBENFmM0nxA9_-b-k8pSDwpLgJU0ce_8,3532
|
|
137
|
+
ccproxy/models/responses.py,sha256=Z0JABm5BaoW0AEM-wriGqWIikY8cJ9ZW9lZPRHX_Zx4,8410
|
|
126
138
|
ccproxy/models/types.py,sha256=27MUg7pVGrK5oWzcrtG_IAoScEcrF20thO94bxZXQww,2729
|
|
127
139
|
ccproxy/observability/__init__.py,sha256=5n9yQBbMLAQVAEJZD-2t4CKfI0Wx2aoDH7d2ynPM4bg,1503
|
|
128
140
|
ccproxy/observability/access_logger.py,sha256=h23GbxRYhPz26-z3rQfFSg12lqwssiXEkJRNmyBJspQ,15755
|
|
@@ -143,13 +155,14 @@ ccproxy/pricing/updater.py,sha256=OKbozb2SIe4yrwWVsQd5ryopZrJ06mIDP6y166-l_tg,10
|
|
|
143
155
|
ccproxy/scheduler/__init__.py,sha256=qVe6NeKPn6NgMqEaG4_K4cYZBCpbFM7g6ptNPEzhi8c,1160
|
|
144
156
|
ccproxy/scheduler/core.py,sha256=Lvhc3i2bfbEnX-2n8lgDBM7YG7TKEnZC3tf8KC5u67M,10344
|
|
145
157
|
ccproxy/scheduler/errors.py,sha256=k7dcid0_te7IwwQaad-Jkj7MWFBgIOdgD_y_n5joio0,817
|
|
146
|
-
ccproxy/scheduler/manager.py,sha256=
|
|
158
|
+
ccproxy/scheduler/manager.py,sha256=74VPpicbXHpznl_mF24eketNMtjcMqTUSPNEwGaqQ9s,7815
|
|
147
159
|
ccproxy/scheduler/registry.py,sha256=MaCuOEiJiYjlKS2Yqp3PxeWXpf8AqNPCQ_qeWbWtBCw,4058
|
|
148
|
-
ccproxy/scheduler/tasks.py,sha256=
|
|
160
|
+
ccproxy/scheduler/tasks.py,sha256=bYh6sSJrJHqrgiknG3wIYUNW9T9Cn9EOs2q1p88Nsw4,26678
|
|
149
161
|
ccproxy/services/__init__.py,sha256=ZvnelD15eFLlWHsucYXBFGNrdT7ncdP1KLnqzJNGOCs,251
|
|
150
|
-
ccproxy/services/claude_detection_service.py,sha256=
|
|
162
|
+
ccproxy/services/claude_detection_service.py,sha256=C752oWLpoChR8wBny7x5nksbJJZ3CO5O9J9wZyaAdHk,8938
|
|
151
163
|
ccproxy/services/claude_sdk_service.py,sha256=IuT4XP116fXzk20SUiYhKiKRoOxeeo7jlGzKVLH2NEo,25954
|
|
152
|
-
ccproxy/services/
|
|
164
|
+
ccproxy/services/codex_detection_service.py,sha256=OTfBjD04QAZv71LPGV-2nvGdfpyT6qaGAUwSSiXNX1I,9151
|
|
165
|
+
ccproxy/services/proxy_service.py,sha256=qhVccFnnT2uz3VrVN2ZDBtkRFeL5qR3pgZSsIvLI3co,72656
|
|
153
166
|
ccproxy/services/credentials/__init__.py,sha256=fkCWqxlUyGVA1mxGicn4cvdbYJQo09SG9NoGKzUun3s,1394
|
|
154
167
|
ccproxy/services/credentials/config.py,sha256=97W3GqtxZlBv45oDHJ-plsHiSeFvNI-FTMZEw4CsPes,3221
|
|
155
168
|
ccproxy/services/credentials/manager.py,sha256=AnRvl1_v-eSbAEcmHMcUMmo7UpvTnAHe9QO5caL1JMY,19905
|
|
@@ -165,14 +178,14 @@ ccproxy/utils/__init__.py,sha256=klTwpS5lbhi0Bg6QXIbX01-7oXaLoGjhHf1MKq_4aQQ,431
|
|
|
165
178
|
ccproxy/utils/cost_calculator.py,sha256=mHquyA_1vnPVZ2smjdPwThCJtGu-rF9n8ZvIrAwTF78,7276
|
|
166
179
|
ccproxy/utils/disconnection_monitor.py,sha256=EOKJoTD_wDZ-l-yoOqx6Z488NZm2fFKW3KOwKlTELkE,3128
|
|
167
180
|
ccproxy/utils/id_generator.py,sha256=k6R_W40lJSPi_it4M99EVg9eRD138oC4bv_8Ua3X8ms,301
|
|
168
|
-
ccproxy/utils/model_mapping.py,sha256=
|
|
181
|
+
ccproxy/utils/model_mapping.py,sha256=RYhUXViV8ElqdURKVsOXzggPFORVmQ6Mb3b3_FpN4Cs,6621
|
|
169
182
|
ccproxy/utils/models_provider.py,sha256=F0_nwNsx-gGhobdTnPQh9zfrhOfw7cBrW2RR09SYY3Q,4434
|
|
170
183
|
ccproxy/utils/simple_request_logger.py,sha256=d54aXW_0P7zewGRzjwDu7QfJ-DGn4zJXu2R5hGXh-rU,8223
|
|
171
|
-
ccproxy/utils/startup_helpers.py,sha256=
|
|
184
|
+
ccproxy/utils/startup_helpers.py,sha256=whuloWETE0A4UUJ6nDf0lh3GhM3NyOMNAqpz9q21FF0,22399
|
|
172
185
|
ccproxy/utils/streaming_metrics.py,sha256=JkvmWJ9s1fuKi7x1NoSoderUuT-mU6MQfbnN5GmziYE,7761
|
|
173
|
-
ccproxy/utils/version_checker.py,sha256=
|
|
174
|
-
ccproxy_api-0.1.
|
|
175
|
-
ccproxy_api-0.1.
|
|
176
|
-
ccproxy_api-0.1.
|
|
177
|
-
ccproxy_api-0.1.
|
|
178
|
-
ccproxy_api-0.1.
|
|
186
|
+
ccproxy/utils/version_checker.py,sha256=KGmaH93hHEFwv-biQuvW_MSLFr6edCVY_WPtr6VyyII,5061
|
|
187
|
+
ccproxy_api-0.1.7.dist-info/METADATA,sha256=3AivL_S4jRJ7sRxtLPvPfh14AB-eufY-oErIL_YBTVk,21136
|
|
188
|
+
ccproxy_api-0.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
189
|
+
ccproxy_api-0.1.7.dist-info/entry_points.txt,sha256=XLke7uRmx6c1G3Ejnvm74x_eTKKtCgRRSk1dXIBFyg4,128
|
|
190
|
+
ccproxy_api-0.1.7.dist-info/licenses/LICENSE,sha256=httxSCpTrEOkipisMeGXSrZhTB-4MRIorQU0hS1B6eQ,1066
|
|
191
|
+
ccproxy_api-0.1.7.dist-info/RECORD,,
|
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: ccproxy-api
|
|
3
|
-
Version: 0.1.5
|
|
4
|
-
Summary: API server that provides an Anthropic and OpenAI compatible interface over Claude Code, allowing to use your Claude OAuth account or over the API.
|
|
5
|
-
License-File: LICENSE
|
|
6
|
-
Requires-Python: >=3.11
|
|
7
|
-
Requires-Dist: aiofiles>=24.1.0
|
|
8
|
-
Requires-Dist: aiosqlite>=0.21.0
|
|
9
|
-
Requires-Dist: claude-code-sdk>=0.0.19
|
|
10
|
-
Requires-Dist: duckdb-engine>=0.17.0
|
|
11
|
-
Requires-Dist: duckdb>=1.1.0
|
|
12
|
-
Requires-Dist: fastapi-mcp
|
|
13
|
-
Requires-Dist: fastapi[standard]>=0.115.14
|
|
14
|
-
Requires-Dist: httpx-sse>=0.4.1
|
|
15
|
-
Requires-Dist: httpx>=0.28.1
|
|
16
|
-
Requires-Dist: jsonschema>=0.33.2
|
|
17
|
-
Requires-Dist: keyring>=25.6.0
|
|
18
|
-
Requires-Dist: openai>=1.93.0
|
|
19
|
-
Requires-Dist: prometheus-client>=0.22.1
|
|
20
|
-
Requires-Dist: pydantic-settings>=2.4.0
|
|
21
|
-
Requires-Dist: pydantic>=2.8.0
|
|
22
|
-
Requires-Dist: rich-toolkit>=0.14.8
|
|
23
|
-
Requires-Dist: rich>=13.0.0
|
|
24
|
-
Requires-Dist: sqlmodel>=0.0.24
|
|
25
|
-
Requires-Dist: structlog>=25.4.0
|
|
26
|
-
Requires-Dist: textual>=3.7.1
|
|
27
|
-
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
|
|
28
|
-
Requires-Dist: typer>=0.16.0
|
|
29
|
-
Requires-Dist: typing-extensions>=4.0.0
|
|
30
|
-
Requires-Dist: uvicorn>=0.34.0
|
|
31
|
-
Description-Content-Type: text/markdown
|
|
32
|
-
|
|
33
|
-
# CCProxy API Server
|
|
34
|
-
|
|
35
|
-
`ccproxy` is a local reverse proxy server for Anthropic Claude LLM at `api.anthropic.com/v1/messages`. It allows you to use your existing Claude Max subscription to interact with the Anthropic API, bypassing the need for separate API key billing.
|
|
36
|
-
|
|
37
|
-
The server provides two primary modes of operation:
|
|
38
|
-
* **SDK Mode (`/sdk`):** Routes requests through the local `claude-code-sdk`. This enables access to tools configured in your Claude environment and includes an integrated MCP (Model Context Protocol) server for permission management.
|
|
39
|
-
* **API Mode (`/api`):** Acts as a direct reverse proxy, injecting the necessary authentication headers. This provides full access to the underlying API features and model settings.
|
|
40
|
-
|
|
41
|
-
It includes a translation layer to support both Anthropic and OpenAI-compatible API formats for requests and responses, including streaming.
|
|
42
|
-
|
|
43
|
-
## Installation
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# The official claude-code CLI is required for SDK mode
|
|
47
|
-
npm install -g @anthropic-ai/claude-code
|
|
48
|
-
|
|
49
|
-
# run it with uv
|
|
50
|
-
uvx ccproxy-api
|
|
51
|
-
|
|
52
|
-
# run it with pipx
|
|
53
|
-
pipx run ccproxy-api
|
|
54
|
-
|
|
55
|
-
# install with uv
|
|
56
|
-
uv tool install ccproxy-api
|
|
57
|
-
|
|
58
|
-
# Install ccproxy with pip
|
|
59
|
-
pipx install ccproxy-api
|
|
60
|
-
|
|
61
|
-
# Optional: Enable shell completion
|
|
62
|
-
eval "$(ccproxy --show-completion zsh)" # For zsh
|
|
63
|
-
eval "$(ccproxy --show-completion bash)" # For bash
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
For dev version replace `ccproxy-api` with `git+https://github.com/caddyglow/ccproxy-api.git@dev`
|
|
68
|
-
|
|
69
|
-
## Authentication
|
|
70
|
-
|
|
71
|
-
The proxy uses two different authentication mechanisms depending on the mode.
|
|
72
|
-
|
|
73
|
-
1. **Claude CLI (`sdk` mode):**
|
|
74
|
-
This mode relies on the authentication handled by the `claude-code-sdk`.
|
|
75
|
-
```bash
|
|
76
|
-
claude /login
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
It's also possible now to get a long live token to avoid renewing issues
|
|
80
|
-
using
|
|
81
|
-
```sh
|
|
82
|
-
```bash
|
|
83
|
-
claude setup-token`
|
|
84
|
-
|
|
85
|
-
2. **ccproxy (`api` mode):**
|
|
86
|
-
This mode uses its own OAuth2 flow to obtain credentials for direct API access.
|
|
87
|
-
```bash
|
|
88
|
-
ccproxy auth login
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
If you are already connected with Claude CLI the credentials should be found automatically
|
|
92
|
-
|
|
93
|
-
You can check the status of these credentials with `ccproxy auth validate` and `ccproxy auth info`.
|
|
94
|
-
|
|
95
|
-
Warning is show on start up if no credentials are setup.
|
|
96
|
-
|
|
97
|
-
## Usage
|
|
98
|
-
|
|
99
|
-
### Running the Server
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
# Start the proxy server
|
|
103
|
-
ccproxy
|
|
104
|
-
```
|
|
105
|
-
The server will start on `http://127.0.0.1:8000` by default.
|
|
106
|
-
|
|
107
|
-
### Client Configuration
|
|
108
|
-
|
|
109
|
-
Point your existing tools and applications to the local proxy instance by setting the appropriate environment variables. A dummy API key is required by most client libraries but is not used by the proxy itself.
|
|
110
|
-
|
|
111
|
-
**For OpenAI-compatible clients:**
|
|
112
|
-
```bash
|
|
113
|
-
# For SDK mode
|
|
114
|
-
export OPENAI_BASE_URL="http://localhost:8000/sdk/v1"
|
|
115
|
-
# For API mode
|
|
116
|
-
export OPENAI_BASE_URL="http://localhost:8000/api/v1"
|
|
117
|
-
|
|
118
|
-
export OPENAI_API_KEY="dummy-key"
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**For Anthropic-compatible clients:**
|
|
122
|
-
```bash
|
|
123
|
-
# For SDK mode
|
|
124
|
-
export ANTHROPIC_BASE_URL="http://localhost:8000/sdk"
|
|
125
|
-
# For API mode
|
|
126
|
-
export ANTHROPIC_BASE_URL="http://localhost:8000/api"
|
|
127
|
-
|
|
128
|
-
export ANTHROPIC_API_KEY="dummy-key"
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
## MCP Server Integration & Permission System
|
|
133
|
-
|
|
134
|
-
In SDK mode, CCProxy automatically configures an MCP (Model Context Protocol) server that provides permission checking tools for Claude Code. This enables interactive permission management for tool execution.
|
|
135
|
-
|
|
136
|
-
### Permission Management
|
|
137
|
-
|
|
138
|
-
**Starting the Permission Handler:**
|
|
139
|
-
```bash
|
|
140
|
-
# In a separate terminal, start the permission handler
|
|
141
|
-
ccproxy permission-handler
|
|
142
|
-
|
|
143
|
-
# Or with custom settings
|
|
144
|
-
ccproxy permission-handler --host 127.0.0.1 --port 8000
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The permission handler provides:
|
|
148
|
-
- **Real-time Permission Requests**: Streams permission requests via Server-Sent Events (SSE)
|
|
149
|
-
- **Interactive Approval/Denial**: Command-line interface for managing tool permissions
|
|
150
|
-
- **Automatic MCP Integration**: Works seamlessly with Claude Code SDK tools
|
|
151
|
-
|
|
152
|
-
**Working Directory Control:**
|
|
153
|
-
Control which project the Claude SDK API can access using the `--cwd` flag:
|
|
154
|
-
```bash
|
|
155
|
-
# Set working directory for Claude SDK
|
|
156
|
-
ccproxy --claude-code-options-cwd /path/to/your/project
|
|
157
|
-
|
|
158
|
-
# Example with permission bypass and formatted output
|
|
159
|
-
ccproxy --claude-code-options-cwd /tmp/tmp.AZyCo5a42N \
|
|
160
|
-
--claude-code-options-permission-mode bypassPermissions \
|
|
161
|
-
--claude-sdk-message-mode formatted
|
|
162
|
-
|
|
163
|
-
# Alternative: Change to project directory and start ccproxy
|
|
164
|
-
cd /path/to/your/project
|
|
165
|
-
ccproxy
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Claude SDK Message Formatting
|
|
169
|
-
|
|
170
|
-
CCProxy supports flexible message formatting through the `sdk_message_mode` configuration:
|
|
171
|
-
|
|
172
|
-
- **`forward`** (default): Preserves original Claude SDK content blocks with full metadata
|
|
173
|
-
- **`formatted`**: Converts content to XML tags with pretty-printed JSON data
|
|
174
|
-
- **`ignore`**: Filters out Claude SDK-specific content entirely
|
|
175
|
-
|
|
176
|
-
Configure via environment variables:
|
|
177
|
-
```bash
|
|
178
|
-
# Use formatted XML output
|
|
179
|
-
CLAUDE__SDK_MESSAGE_MODE=formatted ccproxy
|
|
180
|
-
|
|
181
|
-
# Use compact formatting without pretty-printing
|
|
182
|
-
CLAUDE__PRETTY_FORMAT=false ccproxy
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## Claude SDK Pool Mode
|
|
186
|
-
|
|
187
|
-
CCProxy supports connection pooling for Claude Code SDK clients to improve request performance by maintaining a pool of pre-initialized Claude instances.
|
|
188
|
-
|
|
189
|
-
### Benefits
|
|
190
|
-
- **Reduced Latency**: Eliminates Claude Code startup overhead on each request
|
|
191
|
-
- **Improved Performance**: Reuses established connections for faster response times
|
|
192
|
-
- **Resource Efficiency**: Maintains a configurable pool size to balance performance and resource usage
|
|
193
|
-
|
|
194
|
-
### Usage
|
|
195
|
-
Pool mode is disabled by default and can be enabled using the CLI flag:
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
# Enable pool mode with default settings
|
|
199
|
-
ccproxy --sdk-enable-pool
|
|
200
|
-
|
|
201
|
-
# Configure pool size (default: 3)
|
|
202
|
-
ccproxy --sdk-enable-pool --sdk-pool-size 5
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Limitations
|
|
206
|
-
- **No Dynamic Options**: Pool instances cannot change Claude options (max_tokens, model, etc.) after initialization
|
|
207
|
-
- **Shared Configuration**: All requests using the pool must use identical Claude configuration
|
|
208
|
-
- **Memory Usage**: Each pool instance consumes additional memory
|
|
209
|
-
|
|
210
|
-
Pool mode is most effective for high-frequency requests with consistent configuration requirements.
|
|
211
|
-
|
|
212
|
-
## Using with Aider
|
|
213
|
-
|
|
214
|
-
CCProxy works seamlessly with Aider and other AI coding assistants:
|
|
215
|
-
|
|
216
|
-
### Anthropic Mode
|
|
217
|
-
```bash
|
|
218
|
-
export ANTHROPIC_API_KEY=dummy
|
|
219
|
-
export ANTHROPIC_BASE_URL=http://127.0.0.1:8000/api
|
|
220
|
-
aider --model claude-sonnet-4-20250514
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### OpenAI Mode with Model Mapping
|
|
224
|
-
|
|
225
|
-
If your tool only supports OpenAI settings, ccproxy automatically maps OpenAI models to Claude:
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
export OPENAI_API_KEY=dummy
|
|
229
|
-
export OPENAI_BASE_URL=http://127.0.0.1:8000/api/v1
|
|
230
|
-
aider --model o3-mini
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### API Mode (Direct Proxy)
|
|
234
|
-
|
|
235
|
-
For minimal interference and direct API access:
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
export OPENAI_API_KEY=dummy
|
|
239
|
-
export OPENAI_BASE_URL=http://127.0.0.1:8000/api/v1
|
|
240
|
-
aider --model o3-mini
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### `curl` Example
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
# SDK mode
|
|
247
|
-
curl -X POST http://localhost:8000/sdk/v1/messages \
|
|
248
|
-
-H "Content-Type: application/json" \
|
|
249
|
-
-d '{
|
|
250
|
-
"model": "claude-3-5-sonnet-20241022",
|
|
251
|
-
"messages": [{"role": "user", "content": "Hello!"}],
|
|
252
|
-
"max_tokens": 100
|
|
253
|
-
}'
|
|
254
|
-
|
|
255
|
-
# API mode
|
|
256
|
-
curl -X POST http://localhost:8000/api/v1/messages \
|
|
257
|
-
-H "Content-Type: application/json" \
|
|
258
|
-
-d '{
|
|
259
|
-
"model": "claude-3-5-sonnet-20241022",
|
|
260
|
-
"messages": [{"role": "user", "content": "Hello!"}],
|
|
261
|
-
"max_tokens": 100
|
|
262
|
-
}'
|
|
263
|
-
```
|
|
264
|
-
More examples are available in the `examples/` directory.
|
|
265
|
-
|
|
266
|
-
## Endpoints
|
|
267
|
-
|
|
268
|
-
The proxy exposes endpoints under two prefixes, corresponding to its operating modes.
|
|
269
|
-
|
|
270
|
-
| Mode | URL Prefix | Description | Use Case |
|
|
271
|
-
|------|------------|-------------|----------|
|
|
272
|
-
| **SDK** | `/sdk/` | Uses `claude-code-sdk` with its configured tools. | Accessing Claude with local tools. |
|
|
273
|
-
| **API** | `/api/` | Direct proxy with header injection. | Full API control, direct access. |
|
|
274
|
-
|
|
275
|
-
* **Anthropic:**
|
|
276
|
-
* `POST /sdk/v1/messages`
|
|
277
|
-
* `POST /api/v1/messages`
|
|
278
|
-
* **OpenAI-Compatible:**
|
|
279
|
-
* `POST /sdk/v1/chat/completions`
|
|
280
|
-
* `POST /api/v1/chat/completions`
|
|
281
|
-
* **Utility:**
|
|
282
|
-
* `GET /health`
|
|
283
|
-
* `GET /sdk/models`, `GET /api/models`
|
|
284
|
-
* `GET /sdk/status`, `GET /api/status`
|
|
285
|
-
* `GET /oauth/callback`
|
|
286
|
-
* **MCP & Permissions:**
|
|
287
|
-
* `POST /mcp/permission/check` - MCP permission checking endpoint
|
|
288
|
-
* `GET /permissions/stream` - SSE stream for permission requests
|
|
289
|
-
* `GET /permissions/{id}` - Get permission request details
|
|
290
|
-
* `POST /permissions/{id}/respond` - Respond to permission request
|
|
291
|
-
* **Observability (Optional):**
|
|
292
|
-
* `GET /metrics`
|
|
293
|
-
* `GET /logs/status`, `GET /logs/query`
|
|
294
|
-
* `GET /dashboard`
|
|
295
|
-
|
|
296
|
-
## Supported Models
|
|
297
|
-
|
|
298
|
-
CCProxy supports recent Claude models including Opus, Sonnet, and Haiku variants. The specific models available to you will depend on your Claude account and the features enabled for your subscription.
|
|
299
|
-
|
|
300
|
-
* `claude-opus-4-20250514`
|
|
301
|
-
* `claude-sonnet-4-20250514`
|
|
302
|
-
* `claude-3-7-sonnet-20250219`
|
|
303
|
-
* `claude-3-5-sonnet-20241022`
|
|
304
|
-
* `claude-3-5-sonnet-20240620`
|
|
305
|
-
|
|
306
|
-
## Configuration
|
|
307
|
-
|
|
308
|
-
Settings can be configured through (in order of precedence):
|
|
309
|
-
1. Command-line arguments
|
|
310
|
-
2. Environment variables
|
|
311
|
-
3. `.env` file
|
|
312
|
-
4. TOML configuration files (`.ccproxy.toml`, `ccproxy.toml`, or `~/.config/ccproxy/config.toml`)
|
|
313
|
-
5. Default values
|
|
314
|
-
|
|
315
|
-
For complex configurations, you can use a nested syntax for environment variables with `__` as a delimiter:
|
|
316
|
-
|
|
317
|
-
```bash
|
|
318
|
-
# Server settings
|
|
319
|
-
SERVER__HOST=0.0.0.0
|
|
320
|
-
SERVER__PORT=8080
|
|
321
|
-
# etc.
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
## Securing the Proxy (Optional)
|
|
325
|
-
|
|
326
|
-
You can enable token authentication for the proxy. This supports multiple header formats (`x-api-key` for Anthropic, `Authorization: Bearer` for OpenAI) for compatibility with standard client libraries.
|
|
327
|
-
|
|
328
|
-
**1. Generate a Token:**
|
|
329
|
-
```bash
|
|
330
|
-
ccproxy generate-token
|
|
331
|
-
# Output: SECURITY__AUTH_TOKEN=abc123xyz789...
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
**2. Configure the Token:**
|
|
335
|
-
```bash
|
|
336
|
-
# Set environment variable
|
|
337
|
-
export SECURITY__AUTH_TOKEN=abc123xyz789...
|
|
338
|
-
|
|
339
|
-
# Or add to .env file
|
|
340
|
-
echo "SECURITY__AUTH_TOKEN=abc123xyz789..." >> .env
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
**3. Use in Requests:**
|
|
344
|
-
When authentication is enabled, include the token in your API requests.
|
|
345
|
-
```bash
|
|
346
|
-
# Anthropic Format (x-api-key)
|
|
347
|
-
curl -H "x-api-key: your-token" ...
|
|
348
|
-
|
|
349
|
-
# OpenAI/Bearer Format
|
|
350
|
-
curl -H "Authorization: Bearer your-token" ...
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
## Observability
|
|
354
|
-
|
|
355
|
-
`ccproxy` includes an optional but powerful observability suite for monitoring and analytics. When enabled, it provides:
|
|
356
|
-
|
|
357
|
-
* **Prometheus Metrics:** A `/metrics` endpoint for real-time operational monitoring.
|
|
358
|
-
* **Access Log Storage:** Detailed request logs, including token usage and costs, are stored in a local DuckDB database.
|
|
359
|
-
* **Analytics API:** Endpoints to query and analyze historical usage data.
|
|
360
|
-
* **Real-time Dashboard:** A live web interface at `/dashboard` to visualize metrics and request streams.
|
|
361
|
-
|
|
362
|
-
These features are disabled by default and can be enabled via configuration. For a complete guide on setting up and using these features, see the [Observability Documentation](docs/observability.md).
|
|
363
|
-
|
|
364
|
-
## Troubleshooting
|
|
365
|
-
|
|
366
|
-
### Common Issues
|
|
367
|
-
|
|
368
|
-
1. **Authentication Error:** Ensure you're using the correct mode (`/sdk` or `/api`) for your authentication method.
|
|
369
|
-
2. **Claude Credentials Expired:** Run `ccproxy auth login` to refresh credentials for API mode. Run `claude /login` for SDK mode.
|
|
370
|
-
3. **Missing API Auth Token:** If you've enabled security, include the token in your request headers.
|
|
371
|
-
4. **Port Already in Use:** Start the server on a different port: `ccproxy --port 8001`.
|
|
372
|
-
5. **Model Not Available:** Check that your Claude subscription includes the requested model.
|
|
373
|
-
|
|
374
|
-
## Contributing
|
|
375
|
-
|
|
376
|
-
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
377
|
-
|
|
378
|
-
## License
|
|
379
|
-
|
|
380
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
381
|
-
|
|
382
|
-
## Documentation
|
|
383
|
-
|
|
384
|
-
- **[Online Documentation](https://caddyglow.github.io/ccproxy-api)**
|
|
385
|
-
- **[API Reference](https://caddyglow.github.io/ccproxy-api/api-reference/overview/)**
|
|
386
|
-
- **[Developer Guide](https://caddyglow.github.io/ccproxy-api/developer-guide/architecture/)**
|
|
387
|
-
|
|
388
|
-
## Support
|
|
389
|
-
|
|
390
|
-
- Issues: [GitHub Issues](https://github.com/CaddyGlow/ccproxy-api/issues)
|
|
391
|
-
- Documentation: [Project Documentation](https://caddyglow.github.io/ccproxy-api)
|
|
392
|
-
|
|
393
|
-
## Acknowledgments
|
|
394
|
-
|
|
395
|
-
- [Anthropic](https://anthropic.com) for Claude and the Claude Code SDK
|
|
396
|
-
- The open-source community
|
|
File without changes
|
|
File without changes
|
|
File without changes
|