Claude镜像号池地址:https://share.claude.asia
现在有44个免费账号,我自己共享了30个,坛友贡献了14个
有一些朋友问源码,下面分享下,是用php写的。
在网站根目录新建php文件和session_keys.txt文件:
php文件代码如下:
<?php
// 从文件中读取 session keys
$session_keys = file('session_keys.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$sk_array = array();
for ($i = 0; $i < 44; $i++) {
$sk_array[$i] = trim(explode('=', $session_keys[$i])[1], '"');
}
function getLoginUrl($session_key) {
$ch = curl_init('https://claude.asia/manage-api/auth/oauth_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'session_key' => $session_key,
'unique_name' => uniqid() // 使用 uniqid() 生成唯一名称以实现会话隔离
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if (isset($data['login_url'])) {
// 确保返回完整的 URL
if (strpos($data['login_url'], 'http') !== 0) {
return 'https://claude.asia' . $data['login_url'];
}
return $data['login_url'];
}
return '#'; // 如果无法获取 login_url,返回 '#'
}
function getAccountStatus($account_number) {
$clicks_file = "clicks_{$account_number}.txt";
$current_time = time();
$five_minutes_ago = $current_time - 300; // 5 minutes = 300 seconds
if (file_exists($clicks_file)) {
$clicks = file($clicks_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
// Filter clicks within the last 5 minutes
$recent_clicks = array_filter($clicks, function($click_time) use ($five_minutes_ago) {
return $click_time > $five_minutes_ago;
});
if (count($recent_clicks) >= 1) {
return ['color' => 'red', 'status' => '繁忙'];
}
}
return ['color' => 'green', 'status' => '空闲'];
}
function updateClickTime($account_number) {
$clicks_file = "clicks_{$account_number}.txt";
$current_time = time();
// Read existing clicks
$clicks = file_exists($clicks_file) ? file($clicks_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) : [];
// Add new click time
array_push($clicks, $current_time);
// Keep only the last 5 minutes of clicks
$five_minutes_ago = $current_time - 300;
$clicks = array_filter($clicks, function($click_time) use ($five_minutes_ago) {
return $click_time > $five_minutes_ago;
});
// Save updated clicks
file_put_contents($clicks_file, implode("\n", $clicks));
}
if (isset($_GET['clicked'])) {
$clicked_account = $_GET['clicked'];
updateClickTime($clicked_account);
exit;
}
$login_urls = [];
$account_statuses = [];
for ($i = 1; $i <= 44; $i++) {
$login_urls[$i] = getLoginUrl($sk_array[$i-1]);
$account_statuses[$i] = getAccountStatus($i);
}
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Claude免费镜像号池</title>
<style>
body, html {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
min-height: 100vh;
background: linear-gradient(135deg, #ffffff, #f0f0f0);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 0;
}
h1 {
color: #333;
margin: 0;
}
nav {
text-align: right;
}
.nav-link {
background-color: #764ba2;
color: white;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
transition: background-color 0.3s;
}
.nav-link:hover {
background-color: #5a3a7e;
}
.accounts {
display: grid;
grid-template-columns: repeat(10, 1fr);
gap: 10px;
margin-top: 20px;
}
.account {
background-color: #4CAF50;
color: white;
text-decoration: none;
padding: 10px 5px;
border-radius: 5px;
text-align: center;
font-size: 0.9rem;
transition: transform 0.3s, background-color 0.3s;
}
.account:hover {
transform: scale(1.05);
}
.account.red {
background-color: #f34336;
}
footer {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #ddd;
}
.footer-left {
flex: 1;
}
.footer-right {
display: flex;
gap: 20px;
}
.qr-code {
text-align: center;
}
.qr-code img {
width: 100px;
height: 100px;
}
.copyright {
text-align: center;
margin-top: 20px;
font-size: 0.9rem;
color: #666;
}
@media (max-width: 768px) {
.accounts {
grid-template-columns: repeat(3, 1fr);
}
footer {
flex-direction: column;
align-items: center;
}
.footer-left {
text-align: center;
margin-bottom: 20px;
}
.footer-right {
justify-content: center;
}
}
</style>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
function updateStatus(accountNumber) {
$.get('?clicked=' + accountNumber, function() {
location.reload();
});
}
</script>
</head>
<body>
<div class="container">
<header>
<img src="https://share.claude.asia/img/logo.png" height="30" alt="logo">
<nav>
</nav>
</header>
<main>
<h2 style="text-align:center;">免费账号</h2>
<div class="accounts">
<?php for ($i = 1; $i <= 44; $i++): ?>
<a href="<?php echo htmlspecialchars($login_urls[$i]); ?>"
class="account <?php echo $account_statuses[$i]['color']; ?>"
target="_blank"
onclick="updateStatus(<?php echo $i; ?>)">
账号<?php echo $i; ?><br>(<?php echo $account_statuses[$i]['status']; ?>)
</a>
<?php endfor; ?>
</div>
</main>
<footer>
<div class="footer-left">
</div>
<div class="footer-right">
</div>
</div>
</footer>
<div class="copyright">
© Claude.asia
</div>
</div>
</body>
</html>
代码添加了繁忙检测,五分钟内有点击账号链接则为繁忙。
seesion_keys.txt中放入seesionkey,按照以下格式:
sk1="sk-xxx"
sk2="sk-xxx"
php中放了44个key,有多少个key,就修改44为对应的值。
源码中的 https://claude.asia,是部署的始皇fuclaude项目,可以自己搭建更换为自己的地址。
为了预防sessionkey泄露,请修改session_keys.txt名称,同时记得修改源码中对应名称。