Update hf.js
Browse files
hf.js
CHANGED
|
@@ -216,37 +216,44 @@ app.get('/', (req, res) => {
|
|
| 216 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 217 |
<title>Cursor To OpenAI</title>
|
| 218 |
<style>
|
|
|
|
| 219 |
:root {
|
| 220 |
--bg-primary: #ffffff;
|
| 221 |
-
--bg-secondary: #
|
| 222 |
-
--bg-tertiary: #
|
| 223 |
-
--text-primary: #
|
| 224 |
-
--text-secondary: #
|
| 225 |
-
--border-color: #
|
| 226 |
--accent-color: #5D5CDE;
|
|
|
|
| 227 |
--success-bg: #e1f5e1;
|
| 228 |
--success-border: #c3e6cb;
|
| 229 |
--warning-bg: #fff3cd;
|
| 230 |
--warning-border: #ffeeba;
|
| 231 |
-
--card-shadow: 0 2px
|
|
|
|
|
|
|
| 232 |
}
|
| 233 |
|
| 234 |
[data-theme="dark"] {
|
| 235 |
-
--bg-primary: #
|
| 236 |
-
--bg-secondary: #
|
| 237 |
-
--bg-tertiary: #
|
| 238 |
-
--text-primary: #
|
| 239 |
-
--text-secondary: #
|
| 240 |
-
--border-color: #
|
| 241 |
--accent-color: #7D7CED;
|
|
|
|
| 242 |
--success-bg: #1e3a1e;
|
| 243 |
--success-border: #2a5a2a;
|
| 244 |
--warning-bg: #3a3018;
|
| 245 |
--warning-border: #5a4820;
|
| 246 |
-
--card-shadow: 0 2px
|
|
|
|
| 247 |
}
|
| 248 |
|
| 249 |
-
|
|
|
|
| 250 |
box-sizing: border-box;
|
| 251 |
margin: 0;
|
| 252 |
padding: 0;
|
|
@@ -256,376 +263,653 @@ app.get('/', (req, res) => {
|
|
| 256 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 257 |
background-color: var(--bg-primary);
|
| 258 |
color: var(--text-primary);
|
| 259 |
-
line-height: 1.
|
| 260 |
-
transition:
|
| 261 |
-
padding:
|
|
|
|
| 262 |
max-width: 100vw;
|
| 263 |
}
|
| 264 |
|
|
|
|
| 265 |
h1, h2, h3, h4 {
|
| 266 |
-
margin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
}
|
| 268 |
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
margin: 0 auto;
|
| 272 |
background: var(--bg-secondary);
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
|
|
|
| 276 |
}
|
| 277 |
|
| 278 |
-
.
|
| 279 |
display: flex;
|
| 280 |
-
justify-content: space-between;
|
| 281 |
align-items: center;
|
| 282 |
-
|
|
|
|
|
|
|
| 283 |
border-bottom: 1px solid var(--border-color);
|
| 284 |
}
|
| 285 |
|
| 286 |
-
.
|
| 287 |
display: flex;
|
| 288 |
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
}
|
| 290 |
|
| 291 |
-
.
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
width: 50px;
|
| 295 |
-
height: 24px;
|
| 296 |
-
margin-left: 10px;
|
| 297 |
}
|
| 298 |
|
| 299 |
-
.
|
| 300 |
-
|
| 301 |
-
width:
|
| 302 |
-
|
| 303 |
}
|
| 304 |
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
right: 0;
|
| 311 |
-
bottom: 0;
|
| 312 |
-
background-color: var(--bg-tertiary);
|
| 313 |
-
transition: .4s;
|
| 314 |
-
border-radius: 24px;
|
| 315 |
}
|
| 316 |
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
bottom: 4px;
|
| 324 |
-
background-color: var(--accent-color);
|
| 325 |
-
transition: .4s;
|
| 326 |
-
border-radius: 50%;
|
| 327 |
}
|
| 328 |
|
| 329 |
-
|
| 330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
}
|
| 332 |
|
| 333 |
-
.
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
gap: 20px;
|
| 338 |
}
|
| 339 |
|
| 340 |
-
.
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
padding: 15px;
|
| 345 |
overflow: hidden;
|
| 346 |
-
|
| 347 |
}
|
| 348 |
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
gap: 10px;
|
| 353 |
}
|
| 354 |
|
| 355 |
-
.
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
margin-bottom: 5px;
|
| 360 |
}
|
| 361 |
|
| 362 |
-
.
|
| 363 |
-
|
| 364 |
-
|
|
|
|
|
|
|
| 365 |
color: var(--text-secondary);
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
.info-item span {
|
| 370 |
-
font-size: 0.9rem;
|
| 371 |
-
word-break: break-all;
|
| 372 |
}
|
| 373 |
|
| 374 |
-
.
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
border-radius: 12px;
|
| 378 |
-
font-size: 0.8rem;
|
| 379 |
-
font-weight: 500;
|
| 380 |
}
|
| 381 |
|
| 382 |
-
.
|
| 383 |
-
|
| 384 |
-
color: var(--success-border);
|
| 385 |
}
|
| 386 |
|
| 387 |
-
.
|
| 388 |
-
|
| 389 |
-
color: var(--warning-border);
|
| 390 |
}
|
| 391 |
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
}
|
| 396 |
|
| 397 |
.models-grid {
|
| 398 |
display: flex;
|
| 399 |
flex-wrap: wrap;
|
| 400 |
-
gap:
|
|
|
|
| 401 |
overflow-y: auto;
|
| 402 |
-
|
| 403 |
-
|
|
|
|
| 404 |
}
|
| 405 |
|
| 406 |
.model-tag {
|
| 407 |
background: var(--bg-secondary);
|
|
|
|
| 408 |
border: 1px solid var(--border-color);
|
| 409 |
border-radius: 15px;
|
| 410 |
-
padding:
|
| 411 |
font-size: 0.8rem;
|
| 412 |
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
}
|
| 414 |
|
| 415 |
.guide-steps {
|
| 416 |
display: flex;
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
padding-right: 5px;
|
| 422 |
}
|
| 423 |
|
| 424 |
.guide-step {
|
| 425 |
-
|
|
|
|
|
|
|
| 426 |
border-radius: 8px;
|
| 427 |
-
padding: 10px;
|
| 428 |
border-left: 3px solid var(--accent-color);
|
|
|
|
| 429 |
}
|
| 430 |
|
| 431 |
.guide-step h4 {
|
| 432 |
-
|
| 433 |
-
|
|
|
|
| 434 |
}
|
| 435 |
|
| 436 |
-
.guide-step
|
| 437 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
}
|
| 439 |
|
| 440 |
.code-example {
|
| 441 |
-
margin-top:
|
| 442 |
background: var(--bg-primary);
|
| 443 |
-
padding:
|
| 444 |
-
border-radius:
|
| 445 |
font-family: monospace;
|
| 446 |
-
font-size: 0.
|
| 447 |
overflow-x: auto;
|
| 448 |
-
|
| 449 |
}
|
| 450 |
|
| 451 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
display: flex;
|
| 453 |
-
|
| 454 |
-
|
|
|
|
|
|
|
|
|
|
| 455 |
}
|
| 456 |
|
| 457 |
-
.
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
border-bottom: 2px solid transparent;
|
| 462 |
}
|
| 463 |
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
}
|
| 468 |
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
|
|
|
|
|
|
| 472 |
}
|
| 473 |
|
| 474 |
-
.
|
| 475 |
-
|
|
|
|
|
|
|
| 476 |
}
|
| 477 |
|
| 478 |
-
.
|
| 479 |
-
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
}
|
| 482 |
|
| 483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
@media (max-width: 768px) {
|
| 485 |
.dashboard {
|
| 486 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
}
|
| 488 |
|
| 489 |
-
.
|
| 490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
}
|
| 492 |
|
| 493 |
-
.
|
| 494 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 495 |
}
|
| 496 |
}
|
| 497 |
</style>
|
| 498 |
</head>
|
| 499 |
<body>
|
| 500 |
-
<div class="
|
| 501 |
-
|
| 502 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
<div class="theme-toggle">
|
| 504 |
-
Dark Mode
|
| 505 |
-
<label class="switch">
|
| 506 |
<input type="checkbox" id="theme-toggle">
|
| 507 |
-
<span class="slider"></span>
|
| 508 |
</label>
|
| 509 |
</div>
|
| 510 |
-
</
|
| 511 |
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
<
|
| 519 |
-
<span id="endpoint-url">Loading...</span>
|
| 520 |
</div>
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
<
|
| 524 |
-
<span>Cursor Cookie (user_...)</span>
|
| 525 |
</div>
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
<
|
| 529 |
-
<span>
|
| 530 |
-
<span class="status-badge ${proxyConfig ? 'status-enabled' : 'status-disabled'}">
|
| 531 |
-
${proxyConfig ? 'Enabled' : 'Disabled'}
|
| 532 |
-
</span>
|
| 533 |
-
${proxyConfig ? `<div style="margin-top:5px">Server: ${proxyConfig.host}:${proxyConfig.port}</div>` : ''}
|
| 534 |
-
</span>
|
| 535 |
</div>
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
<
|
| 539 |
-
<span>Send requests to the endpoint with your Cursor cookie as the Bearer token in the Authorization header.</span>
|
| 540 |
</div>
|
| 541 |
</div>
|
| 542 |
|
| 543 |
-
<!--
|
| 544 |
-
<div class="
|
| 545 |
-
<
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
<
|
| 549 |
-
<
|
| 550 |
-
<div class="tab" data-models-tab="gpt">GPT</div>
|
| 551 |
-
<div class="tab" data-models-tab="other">Other</div>
|
| 552 |
-
</div>
|
| 553 |
-
|
| 554 |
-
<div id="all-models" class="models-grid tab-content active">
|
| 555 |
-
Loading models...
|
| 556 |
-
</div>
|
| 557 |
-
|
| 558 |
-
<div id="claude-models" class="models-grid tab-content">
|
| 559 |
-
Loading Claude models...
|
| 560 |
-
</div>
|
| 561 |
-
|
| 562 |
-
<div id="gpt-models" class="models-grid tab-content">
|
| 563 |
-
Loading GPT models...
|
| 564 |
</div>
|
| 565 |
|
| 566 |
-
|
| 567 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
</div>
|
| 569 |
-
</div>
|
| 570 |
-
|
| 571 |
-
<!-- Integration Guide -->
|
| 572 |
-
<div class="guide-section">
|
| 573 |
-
<h3 class="section-header">Integration Guide</h3>
|
| 574 |
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
|
|
|
| 579 |
</div>
|
| 580 |
|
| 581 |
-
<div class="
|
| 582 |
-
<
|
| 583 |
-
<
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
|
| 590 |
-
<div class="guide-
|
| 591 |
-
<
|
| 592 |
-
|
| 593 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 594 |
{
|
| 595 |
"model": "claude-3.7-sonnet",
|
| 596 |
"messages": [
|
| 597 |
{"role": "user", "content": "Hello!"}
|
| 598 |
],
|
| 599 |
"temperature": 0.7
|
| 600 |
-
}
|
|
|
|
|
|
|
|
|
|
| 601 |
</div>
|
| 602 |
|
| 603 |
-
<div class="guide-
|
| 604 |
-
<
|
| 605 |
-
<div class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 606 |
method: 'POST',
|
| 607 |
headers: {
|
| 608 |
'Content-Type': 'application/json',
|
| 609 |
-
'Authorization': 'Bearer
|
| 610 |
},
|
| 611 |
body: JSON.stringify({
|
| 612 |
model: 'claude-3.7-sonnet',
|
| 613 |
messages: [
|
| 614 |
-
{ role: 'user', content: 'Hello' }
|
| 615 |
],
|
| 616 |
temperature: 0.7
|
| 617 |
})
|
| 618 |
});
|
| 619 |
|
| 620 |
-
const data = await response.json()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 621 |
</div>
|
| 622 |
</div>
|
| 623 |
</div>
|
| 624 |
-
</
|
| 625 |
</div>
|
| 626 |
|
| 627 |
<script>
|
| 628 |
-
// Theme
|
| 629 |
const themeToggle = document.getElementById('theme-toggle');
|
| 630 |
|
| 631 |
// Check system preference
|
|
@@ -634,7 +918,7 @@ const data = await response.json();</div>
|
|
| 634 |
themeToggle.checked = true;
|
| 635 |
}
|
| 636 |
|
| 637 |
-
// Toggle theme
|
| 638 |
themeToggle.addEventListener('change', function() {
|
| 639 |
if (this.checked) {
|
| 640 |
document.documentElement.setAttribute('data-theme', 'dark');
|
|
@@ -643,99 +927,253 @@ const data = await response.json();</div>
|
|
| 643 |
}
|
| 644 |
});
|
| 645 |
|
| 646 |
-
//
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
document.documentElement.setAttribute('data-theme', 'dark');
|
| 650 |
-
themeToggle.checked = true;
|
| 651 |
-
} else {
|
| 652 |
-
document.documentElement.removeAttribute('data-theme');
|
| 653 |
-
themeToggle.checked = false;
|
| 654 |
-
}
|
| 655 |
-
});
|
| 656 |
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
|
|
|
|
|
|
| 660 |
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 664 |
}
|
| 665 |
|
| 666 |
-
//
|
| 667 |
-
|
| 668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
}
|
| 676 |
|
| 677 |
-
//
|
| 678 |
-
|
| 679 |
-
|
| 680 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 681 |
|
| 682 |
-
|
| 683 |
this.classList.add('active');
|
| 684 |
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
if (tabContent) {
|
| 689 |
-
tabContent.classList.add('active');
|
| 690 |
-
} else if (tabId === 'all-models') {
|
| 691 |
-
document.getElementById('all-models').classList.add('active');
|
| 692 |
}
|
| 693 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
}
|
| 695 |
|
| 696 |
// Load models list
|
| 697 |
fetch('/hf/v1/models')
|
| 698 |
.then(response => response.json())
|
| 699 |
.then(data => {
|
| 700 |
-
//
|
| 701 |
-
|
| 702 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 703 |
});
|
| 704 |
|
| 705 |
-
const
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 709 |
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
otherModelsEl.innerHTML = '';
|
| 715 |
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
|
| 719 |
-
|
| 720 |
-
|
| 721 |
|
| 722 |
-
|
| 723 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 724 |
|
| 725 |
-
//
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
| 731 |
-
|
| 732 |
-
|
| 733 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 734 |
})
|
| 735 |
-
.catch(
|
| 736 |
const allModelsEl = document.getElementById('all-models');
|
| 737 |
-
allModelsEl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 738 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 739 |
</script>
|
| 740 |
</body>
|
| 741 |
</html>
|
|
|
|
| 216 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 217 |
<title>Cursor To OpenAI</title>
|
| 218 |
<style>
|
| 219 |
+
/* Core Variables */
|
| 220 |
:root {
|
| 221 |
--bg-primary: #ffffff;
|
| 222 |
+
--bg-secondary: #f5f7fa;
|
| 223 |
+
--bg-tertiary: #edf0f7;
|
| 224 |
+
--text-primary: #2c3e50;
|
| 225 |
+
--text-secondary: #596877;
|
| 226 |
+
--border-color: #dce1e8;
|
| 227 |
--accent-color: #5D5CDE;
|
| 228 |
+
--accent-hover: #4a49c8;
|
| 229 |
--success-bg: #e1f5e1;
|
| 230 |
--success-border: #c3e6cb;
|
| 231 |
--warning-bg: #fff3cd;
|
| 232 |
--warning-border: #ffeeba;
|
| 233 |
+
--card-shadow: 0 2px 5px rgba(0,0,0,0.05);
|
| 234 |
+
--hover-shadow: 0 5px 15px rgba(0,0,0,0.08);
|
| 235 |
+
--transition: all 0.2s ease-in-out;
|
| 236 |
}
|
| 237 |
|
| 238 |
[data-theme="dark"] {
|
| 239 |
+
--bg-primary: #121821;
|
| 240 |
+
--bg-secondary: #1a2332;
|
| 241 |
+
--bg-tertiary: #243044;
|
| 242 |
+
--text-primary: #e0e6ed;
|
| 243 |
+
--text-secondary: #9ba9b9;
|
| 244 |
+
--border-color: #324156;
|
| 245 |
--accent-color: #7D7CED;
|
| 246 |
+
--accent-hover: #9795f0;
|
| 247 |
--success-bg: #1e3a1e;
|
| 248 |
--success-border: #2a5a2a;
|
| 249 |
--warning-bg: #3a3018;
|
| 250 |
--warning-border: #5a4820;
|
| 251 |
+
--card-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
| 252 |
+
--hover-shadow: 0 5px 15px rgba(0,0,0,0.3);
|
| 253 |
}
|
| 254 |
|
| 255 |
+
/* Reset & Base Styles */
|
| 256 |
+
*, *::before, *::after {
|
| 257 |
box-sizing: border-box;
|
| 258 |
margin: 0;
|
| 259 |
padding: 0;
|
|
|
|
| 263 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 264 |
background-color: var(--bg-primary);
|
| 265 |
color: var(--text-primary);
|
| 266 |
+
line-height: 1.5;
|
| 267 |
+
transition: var(--transition);
|
| 268 |
+
padding: 0;
|
| 269 |
+
overflow-x: hidden;
|
| 270 |
max-width: 100vw;
|
| 271 |
}
|
| 272 |
|
| 273 |
+
/* Typography */
|
| 274 |
h1, h2, h3, h4 {
|
| 275 |
+
margin: 0;
|
| 276 |
+
font-weight: 600;
|
| 277 |
+
line-height: 1.2;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
h1 { font-size: 1.5rem; }
|
| 281 |
+
h2 { font-size: 1.25rem; }
|
| 282 |
+
h3 { font-size: 1.1rem; }
|
| 283 |
+
h4 { font-size: 1rem; }
|
| 284 |
+
|
| 285 |
+
/* Layout */
|
| 286 |
+
.dashboard {
|
| 287 |
+
display: grid;
|
| 288 |
+
grid-template-columns: 250px 1fr;
|
| 289 |
+
min-height: 100vh;
|
| 290 |
}
|
| 291 |
|
| 292 |
+
/* Sidebar */
|
| 293 |
+
.sidebar {
|
|
|
|
| 294 |
background: var(--bg-secondary);
|
| 295 |
+
padding: 1rem;
|
| 296 |
+
border-right: 1px solid var(--border-color);
|
| 297 |
+
display: flex;
|
| 298 |
+
flex-direction: column;
|
| 299 |
}
|
| 300 |
|
| 301 |
+
.logo {
|
| 302 |
display: flex;
|
|
|
|
| 303 |
align-items: center;
|
| 304 |
+
gap: 0.5rem;
|
| 305 |
+
padding-bottom: 1rem;
|
| 306 |
+
margin-bottom: 1rem;
|
| 307 |
border-bottom: 1px solid var(--border-color);
|
| 308 |
}
|
| 309 |
|
| 310 |
+
.nav-item {
|
| 311 |
display: flex;
|
| 312 |
align-items: center;
|
| 313 |
+
padding: 0.5rem 0.75rem;
|
| 314 |
+
margin-bottom: 0.5rem;
|
| 315 |
+
border-radius: 6px;
|
| 316 |
+
cursor: pointer;
|
| 317 |
+
transition: var(--transition);
|
| 318 |
+
color: var(--text-secondary);
|
| 319 |
}
|
| 320 |
|
| 321 |
+
.nav-item:hover, .nav-item.active {
|
| 322 |
+
background: var(--bg-tertiary);
|
| 323 |
+
color: var(--accent-color);
|
|
|
|
|
|
|
|
|
|
| 324 |
}
|
| 325 |
|
| 326 |
+
.nav-item i {
|
| 327 |
+
margin-right: 8px;
|
| 328 |
+
width: 20px;
|
| 329 |
+
text-align: center;
|
| 330 |
}
|
| 331 |
|
| 332 |
+
/* Main Content */
|
| 333 |
+
.main-content {
|
| 334 |
+
padding: 1rem;
|
| 335 |
+
overflow-y: auto;
|
| 336 |
+
height: 100vh;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
}
|
| 338 |
|
| 339 |
+
/* Stats Grid */
|
| 340 |
+
.stats-grid {
|
| 341 |
+
display: grid;
|
| 342 |
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
| 343 |
+
gap: 1rem;
|
| 344 |
+
margin-bottom: 1rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
}
|
| 346 |
|
| 347 |
+
.stat-card {
|
| 348 |
+
background: var(--bg-secondary);
|
| 349 |
+
border-radius: 8px;
|
| 350 |
+
padding: 1rem;
|
| 351 |
+
box-shadow: var(--card-shadow);
|
| 352 |
+
display: flex;
|
| 353 |
+
flex-direction: column;
|
| 354 |
}
|
| 355 |
|
| 356 |
+
.stat-card .label {
|
| 357 |
+
color: var(--text-secondary);
|
| 358 |
+
font-size: 0.875rem;
|
| 359 |
+
margin-bottom: 0.25rem;
|
|
|
|
| 360 |
}
|
| 361 |
|
| 362 |
+
.stat-card .value {
|
| 363 |
+
font-size: 1.25rem;
|
| 364 |
+
font-weight: 600;
|
| 365 |
+
white-space: nowrap;
|
|
|
|
| 366 |
overflow: hidden;
|
| 367 |
+
text-overflow: ellipsis;
|
| 368 |
}
|
| 369 |
|
| 370 |
+
/* Tabs */
|
| 371 |
+
.tabs-container {
|
| 372 |
+
margin-top: 1rem;
|
|
|
|
| 373 |
}
|
| 374 |
|
| 375 |
+
.tabs-header {
|
| 376 |
+
display: flex;
|
| 377 |
+
border-bottom: 1px solid var(--border-color);
|
| 378 |
+
margin-bottom: 1rem;
|
|
|
|
| 379 |
}
|
| 380 |
|
| 381 |
+
.tab-button {
|
| 382 |
+
padding: 0.75rem 1rem;
|
| 383 |
+
background: none;
|
| 384 |
+
border: none;
|
| 385 |
+
border-bottom: 2px solid transparent;
|
| 386 |
color: var(--text-secondary);
|
| 387 |
+
cursor: pointer;
|
| 388 |
+
font-weight: 500;
|
| 389 |
+
transition: var(--transition);
|
|
|
|
|
|
|
|
|
|
| 390 |
}
|
| 391 |
|
| 392 |
+
.tab-button.active {
|
| 393 |
+
color: var(--accent-color);
|
| 394 |
+
border-bottom-color: var(--accent-color);
|
|
|
|
|
|
|
|
|
|
| 395 |
}
|
| 396 |
|
| 397 |
+
.tab-content {
|
| 398 |
+
display: none;
|
|
|
|
| 399 |
}
|
| 400 |
|
| 401 |
+
.tab-content.active {
|
| 402 |
+
display: block;
|
|
|
|
| 403 |
}
|
| 404 |
|
| 405 |
+
/* Models Wall */
|
| 406 |
+
.models-container {
|
| 407 |
+
margin-top: 1rem;
|
| 408 |
}
|
| 409 |
|
| 410 |
.models-grid {
|
| 411 |
display: flex;
|
| 412 |
flex-wrap: wrap;
|
| 413 |
+
gap: 0.5rem;
|
| 414 |
+
max-height: 150px;
|
| 415 |
overflow-y: auto;
|
| 416 |
+
padding: 0.5rem;
|
| 417 |
+
background: var(--bg-tertiary);
|
| 418 |
+
border-radius: 8px;
|
| 419 |
}
|
| 420 |
|
| 421 |
.model-tag {
|
| 422 |
background: var(--bg-secondary);
|
| 423 |
+
color: var(--text-primary);
|
| 424 |
border: 1px solid var(--border-color);
|
| 425 |
border-radius: 15px;
|
| 426 |
+
padding: 0.25rem 0.75rem;
|
| 427 |
font-size: 0.8rem;
|
| 428 |
white-space: nowrap;
|
| 429 |
+
transition: var(--transition);
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
.model-tag:hover {
|
| 433 |
+
background: var(--accent-color);
|
| 434 |
+
color: white;
|
| 435 |
+
border-color: var(--accent-color);
|
| 436 |
+
transform: translateY(-2px);
|
| 437 |
+
box-shadow: var(--hover-shadow);
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
/* Setup Guide */
|
| 441 |
+
.guide-container {
|
| 442 |
+
padding: 1rem;
|
| 443 |
+
background: var(--bg-secondary);
|
| 444 |
+
border-radius: 8px;
|
| 445 |
}
|
| 446 |
|
| 447 |
.guide-steps {
|
| 448 |
display: flex;
|
| 449 |
+
margin-top: 1rem;
|
| 450 |
+
overflow-x: auto;
|
| 451 |
+
gap: 1rem;
|
| 452 |
+
padding-bottom: 0.5rem;
|
|
|
|
| 453 |
}
|
| 454 |
|
| 455 |
.guide-step {
|
| 456 |
+
min-width: 250px;
|
| 457 |
+
padding: 1rem;
|
| 458 |
+
background: var(--bg-tertiary);
|
| 459 |
border-radius: 8px;
|
|
|
|
| 460 |
border-left: 3px solid var(--accent-color);
|
| 461 |
+
flex: 1;
|
| 462 |
}
|
| 463 |
|
| 464 |
.guide-step h4 {
|
| 465 |
+
margin-bottom: 0.5rem;
|
| 466 |
+
display: flex;
|
| 467 |
+
align-items: center;
|
| 468 |
}
|
| 469 |
|
| 470 |
+
.guide-step h4 .step-number {
|
| 471 |
+
display: inline-flex;
|
| 472 |
+
align-items: center;
|
| 473 |
+
justify-content: center;
|
| 474 |
+
width: 24px;
|
| 475 |
+
height: 24px;
|
| 476 |
+
background: var(--accent-color);
|
| 477 |
+
color: white;
|
| 478 |
+
border-radius: 50%;
|
| 479 |
+
margin-right: 0.5rem;
|
| 480 |
+
font-size: 0.8rem;
|
| 481 |
}
|
| 482 |
|
| 483 |
.code-example {
|
| 484 |
+
margin-top: 0.75rem;
|
| 485 |
background: var(--bg-primary);
|
| 486 |
+
padding: 0.75rem;
|
| 487 |
+
border-radius: 6px;
|
| 488 |
font-family: monospace;
|
| 489 |
+
font-size: 0.8rem;
|
| 490 |
overflow-x: auto;
|
| 491 |
+
position: relative;
|
| 492 |
}
|
| 493 |
|
| 494 |
+
.copy-btn {
|
| 495 |
+
position: absolute;
|
| 496 |
+
top: 5px;
|
| 497 |
+
right: 5px;
|
| 498 |
+
background: var(--bg-secondary);
|
| 499 |
+
border: none;
|
| 500 |
+
border-radius: 4px;
|
| 501 |
+
width: 28px;
|
| 502 |
+
height: 28px;
|
| 503 |
display: flex;
|
| 504 |
+
align-items: center;
|
| 505 |
+
justify-content: center;
|
| 506 |
+
cursor: pointer;
|
| 507 |
+
opacity: 0.7;
|
| 508 |
+
transition: var(--transition);
|
| 509 |
}
|
| 510 |
|
| 511 |
+
.copy-btn:hover {
|
| 512 |
+
opacity: 1;
|
| 513 |
+
background: var(--accent-color);
|
| 514 |
+
color: white;
|
|
|
|
| 515 |
}
|
| 516 |
|
| 517 |
+
/* Theme Toggle */
|
| 518 |
+
.theme-toggle {
|
| 519 |
+
margin-top: auto;
|
| 520 |
+
padding-top: 1rem;
|
| 521 |
+
display: flex;
|
| 522 |
+
align-items: center;
|
| 523 |
+
justify-content: space-between;
|
| 524 |
}
|
| 525 |
|
| 526 |
+
.toggle-switch {
|
| 527 |
+
position: relative;
|
| 528 |
+
display: inline-block;
|
| 529 |
+
width: 46px;
|
| 530 |
+
height: 24px;
|
| 531 |
}
|
| 532 |
|
| 533 |
+
.toggle-switch input {
|
| 534 |
+
opacity: 0;
|
| 535 |
+
width: 0;
|
| 536 |
+
height: 0;
|
| 537 |
}
|
| 538 |
|
| 539 |
+
.toggle-slider {
|
| 540 |
+
position: absolute;
|
| 541 |
+
cursor: pointer;
|
| 542 |
+
top: 0;
|
| 543 |
+
left: 0;
|
| 544 |
+
right: 0;
|
| 545 |
+
bottom: 0;
|
| 546 |
+
background-color: var(--bg-tertiary);
|
| 547 |
+
transition: var(--transition);
|
| 548 |
+
border-radius: 24px;
|
| 549 |
}
|
| 550 |
|
| 551 |
+
.toggle-slider:before {
|
| 552 |
+
position: absolute;
|
| 553 |
+
content: "";
|
| 554 |
+
height: 18px;
|
| 555 |
+
width: 18px;
|
| 556 |
+
left: 3px;
|
| 557 |
+
bottom: 3px;
|
| 558 |
+
background-color: var(--accent-color);
|
| 559 |
+
transition: var(--transition);
|
| 560 |
+
border-radius: 50%;
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
input:checked + .toggle-slider {
|
| 564 |
+
background-color: var(--bg-tertiary);
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
input:checked + .toggle-slider:before {
|
| 568 |
+
transform: translateX(22px);
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
/* Responsive Layout */
|
| 572 |
@media (max-width: 768px) {
|
| 573 |
.dashboard {
|
| 574 |
+
grid-template-columns: 1fr;
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
.sidebar {
|
| 578 |
+
display: none;
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
.sidebar.active {
|
| 582 |
+
display: flex;
|
| 583 |
+
position: fixed;
|
| 584 |
+
width: 250px;
|
| 585 |
+
height: 100vh;
|
| 586 |
+
z-index: 1000;
|
| 587 |
}
|
| 588 |
|
| 589 |
+
.mobile-header {
|
| 590 |
+
display: flex;
|
| 591 |
+
justify-content: space-between;
|
| 592 |
+
align-items: center;
|
| 593 |
+
padding: 1rem;
|
| 594 |
+
background: var(--bg-secondary);
|
| 595 |
+
box-shadow: var(--card-shadow);
|
| 596 |
}
|
| 597 |
|
| 598 |
+
.menu-toggle {
|
| 599 |
+
display: block;
|
| 600 |
+
background: none;
|
| 601 |
+
border: none;
|
| 602 |
+
color: var(--text-primary);
|
| 603 |
+
cursor: pointer;
|
| 604 |
+
font-size: 1.5rem;
|
| 605 |
+
}
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
@media (min-width: 769px) {
|
| 609 |
+
.mobile-header {
|
| 610 |
+
display: none;
|
| 611 |
}
|
| 612 |
}
|
| 613 |
</style>
|
| 614 |
</head>
|
| 615 |
<body>
|
| 616 |
+
<div class="dashboard">
|
| 617 |
+
<!-- Mobile Header (shows only on mobile) -->
|
| 618 |
+
<div class="mobile-header">
|
| 619 |
+
<button class="menu-toggle" id="menu-toggle">☰</button>
|
| 620 |
+
<h1>Cursor API</h1>
|
| 621 |
+
<div></div> <!-- Empty div for flexbox spacing -->
|
| 622 |
+
</div>
|
| 623 |
+
|
| 624 |
+
<!-- Sidebar -->
|
| 625 |
+
<aside class="sidebar" id="sidebar">
|
| 626 |
+
<div class="logo">
|
| 627 |
+
<h1>Cursor API</h1>
|
| 628 |
+
</div>
|
| 629 |
+
|
| 630 |
+
<div class="nav-item active" data-tab="dashboard">
|
| 631 |
+
<i>📊</i> Dashboard
|
| 632 |
+
</div>
|
| 633 |
+
<div class="nav-item" data-tab="models">
|
| 634 |
+
<i>🤖</i> Models
|
| 635 |
+
</div>
|
| 636 |
+
<div class="nav-item" data-tab="guide">
|
| 637 |
+
<i>📚</i> Integration Guide
|
| 638 |
+
</div>
|
| 639 |
+
<div class="nav-item" data-tab="tester">
|
| 640 |
+
<i>🧪</i> API Tester
|
| 641 |
+
</div>
|
| 642 |
+
|
| 643 |
+
<!-- Theme Toggle -->
|
| 644 |
<div class="theme-toggle">
|
| 645 |
+
<span>Dark Mode</span>
|
| 646 |
+
<label class="toggle-switch">
|
| 647 |
<input type="checkbox" id="theme-toggle">
|
| 648 |
+
<span class="toggle-slider"></span>
|
| 649 |
</label>
|
| 650 |
</div>
|
| 651 |
+
</aside>
|
| 652 |
|
| 653 |
+
<!-- Main Content -->
|
| 654 |
+
<main class="main-content">
|
| 655 |
+
<!-- Stats Cards -->
|
| 656 |
+
<div class="stats-grid">
|
| 657 |
+
<div class="stat-card">
|
| 658 |
+
<div class="label">API Endpoint</div>
|
| 659 |
+
<div class="value" id="endpoint-url">Loading...</div>
|
|
|
|
| 660 |
</div>
|
| 661 |
+
<div class="stat-card">
|
| 662 |
+
<div class="label">Authentication</div>
|
| 663 |
+
<div class="value">Cursor Cookie (user_...)</div>
|
|
|
|
| 664 |
</div>
|
| 665 |
+
<div class="stat-card">
|
| 666 |
+
<div class="label">Proxy Status</div>
|
| 667 |
+
<div class="value">${proxyConfig ? 'Enabled' : 'Disabled'}</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 668 |
</div>
|
| 669 |
+
<div class="stat-card">
|
| 670 |
+
<div class="label">Available Models</div>
|
| 671 |
+
<div class="value" id="model-count">Loading...</div>
|
|
|
|
| 672 |
</div>
|
| 673 |
</div>
|
| 674 |
|
| 675 |
+
<!-- Tabs Container -->
|
| 676 |
+
<div class="tabs-container">
|
| 677 |
+
<div class="tabs-header">
|
| 678 |
+
<button class="tab-button active" data-tab="dashboard">Dashboard</button>
|
| 679 |
+
<button class="tab-button" data-tab="models">Models</button>
|
| 680 |
+
<button class="tab-button" data-tab="guide">Integration Guide</button>
|
| 681 |
+
<button class="tab-button" data-tab="tester">API Tester</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 682 |
</div>
|
| 683 |
|
| 684 |
+
<!-- Dashboard Tab -->
|
| 685 |
+
<div class="tab-content active" id="dashboard-tab">
|
| 686 |
+
<h2>Server Information</h2>
|
| 687 |
+
<div class="models-container">
|
| 688 |
+
<h3>Featured Models</h3>
|
| 689 |
+
<div class="models-grid" id="featured-models">
|
| 690 |
+
Loading...
|
| 691 |
+
</div>
|
| 692 |
+
</div>
|
| 693 |
+
|
| 694 |
+
<!-- Connection Guide Summary -->
|
| 695 |
+
<div class="guide-container">
|
| 696 |
+
<h3>Quick Start Guide</h3>
|
| 697 |
+
<div class="guide-steps">
|
| 698 |
+
<div class="guide-step">
|
| 699 |
+
<h4><span class="step-number">1</span>Authentication</h4>
|
| 700 |
+
<p>Get your Cursor cookie that starts with "user_..." from browser cookies after logging in to Cursor.</p>
|
| 701 |
+
</div>
|
| 702 |
+
<div class="guide-step">
|
| 703 |
+
<h4><span class="step-number">2</span>API Requests</h4>
|
| 704 |
+
<p>Send POST requests to <span id="endpoint-shorthand">Loading...</span> with your Cursor cookie as Bearer token.</p>
|
| 705 |
+
</div>
|
| 706 |
+
<div class="guide-step">
|
| 707 |
+
<h4><span class="step-number">3</span>Request Format</h4>
|
| 708 |
+
<p>Use OpenAI-compatible format with model, messages array, and optional parameters.</p>
|
| 709 |
+
</div>
|
| 710 |
+
</div>
|
| 711 |
+
</div>
|
| 712 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 713 |
|
| 714 |
+
<!-- Models Tab -->
|
| 715 |
+
<div class="tab-content" id="models-tab">
|
| 716 |
+
<h2>Available Models</h2>
|
| 717 |
+
<div class="models-grid" id="all-models">
|
| 718 |
+
Loading...
|
| 719 |
</div>
|
| 720 |
|
| 721 |
+
<div class="models-container">
|
| 722 |
+
<h3>Model Categories</h3>
|
| 723 |
+
<div class="stats-grid">
|
| 724 |
+
<div class="stat-card">
|
| 725 |
+
<div class="label">Claude Models</div>
|
| 726 |
+
<div class="value" id="claude-count">-</div>
|
| 727 |
+
</div>
|
| 728 |
+
<div class="stat-card">
|
| 729 |
+
<div class="label">GPT Models</div>
|
| 730 |
+
<div class="value" id="gpt-count">-</div>
|
| 731 |
+
</div>
|
| 732 |
+
<div class="stat-card">
|
| 733 |
+
<div class="label">Gemini Models</div>
|
| 734 |
+
<div class="value" id="gemini-count">-</div>
|
| 735 |
+
</div>
|
| 736 |
+
<div class="stat-card">
|
| 737 |
+
<div class="label">Other Models</div>
|
| 738 |
+
<div class="value" id="other-count">-</div>
|
| 739 |
+
</div>
|
| 740 |
+
</div>
|
| 741 |
</div>
|
| 742 |
+
</div>
|
| 743 |
+
|
| 744 |
+
<!-- Integration Guide Tab -->
|
| 745 |
+
<div class="tab-content" id="guide-tab">
|
| 746 |
+
<h2>Integration Guide</h2>
|
| 747 |
|
| 748 |
+
<div class="guide-steps">
|
| 749 |
+
<div class="guide-step">
|
| 750 |
+
<h4><span class="step-number">1</span>Authentication</h4>
|
| 751 |
+
<p>To authenticate with the Cursor API:</p>
|
| 752 |
+
<ol style="margin-left: 1rem; margin-top: 0.5rem;">
|
| 753 |
+
<li>Log in to <a href="https://cursor.so" target="_blank">Cursor.so</a></li>
|
| 754 |
+
<li>Open Developer Tools (F12)</li>
|
| 755 |
+
<li>Go to Application → Cookies</li>
|
| 756 |
+
<li>Find cookie with name starting with "user_"</li>
|
| 757 |
+
<li>Use this value as your API key</li>
|
| 758 |
+
</ol>
|
| 759 |
+
</div>
|
| 760 |
+
|
| 761 |
+
<div class="guide-step">
|
| 762 |
+
<h4><span class="step-number">2</span>API Configuration</h4>
|
| 763 |
+
<p>Set up your API client with:</p>
|
| 764 |
+
<ul style="margin-left: 1rem; margin-top: 0.5rem;">
|
| 765 |
+
<li>Base URL: <span id="endpoint-guide">Loading...</span></li>
|
| 766 |
+
<li>Headers:</li>
|
| 767 |
+
<div class="code-example">
|
| 768 |
+
Content-Type: application/json
|
| 769 |
+
Authorization: Bearer user_your_cookie_value
|
| 770 |
+
</div>
|
| 771 |
+
</ul>
|
| 772 |
+
</div>
|
| 773 |
+
|
| 774 |
+
<div class="guide-step">
|
| 775 |
+
<h4><span class="step-number">3</span>Making Requests</h4>
|
| 776 |
+
<p>Send chat completion requests:</p>
|
| 777 |
+
<div class="code-example">
|
| 778 |
+
POST /chat/completions
|
| 779 |
{
|
| 780 |
"model": "claude-3.7-sonnet",
|
| 781 |
"messages": [
|
| 782 |
{"role": "user", "content": "Hello!"}
|
| 783 |
],
|
| 784 |
"temperature": 0.7
|
| 785 |
+
}
|
| 786 |
+
<button class="copy-btn" title="Copy to clipboard">📋</button>
|
| 787 |
+
</div>
|
| 788 |
+
</div>
|
| 789 |
</div>
|
| 790 |
|
| 791 |
+
<div class="guide-container">
|
| 792 |
+
<h3>Code Examples</h3>
|
| 793 |
+
<div class="tabs-header" style="margin-top: 0.5rem;">
|
| 794 |
+
<button class="tab-button active" data-code-tab="js">JavaScript</button>
|
| 795 |
+
<button class="tab-button" data-code-tab="python">Python</button>
|
| 796 |
+
<button class="tab-button" data-code-tab="curl">cURL</button>
|
| 797 |
+
</div>
|
| 798 |
+
|
| 799 |
+
<div class="code-tab active" id="js-code">
|
| 800 |
+
<div class="code-example">
|
| 801 |
+
const response = await fetch('${req.protocol}://${req.get('host')}/hf/v1/chat/completions', {
|
| 802 |
method: 'POST',
|
| 803 |
headers: {
|
| 804 |
'Content-Type': 'application/json',
|
| 805 |
+
'Authorization': 'Bearer user_your_cookie_value'
|
| 806 |
},
|
| 807 |
body: JSON.stringify({
|
| 808 |
model: 'claude-3.7-sonnet',
|
| 809 |
messages: [
|
| 810 |
+
{ role: 'user', content: 'Hello, who are you?' }
|
| 811 |
],
|
| 812 |
temperature: 0.7
|
| 813 |
})
|
| 814 |
});
|
| 815 |
|
| 816 |
+
const data = await response.json();
|
| 817 |
+
console.log(data);
|
| 818 |
+
<button class="copy-btn" title="Copy to clipboard">📋</button>
|
| 819 |
+
</div>
|
| 820 |
+
</div>
|
| 821 |
+
|
| 822 |
+
<div class="code-tab" id="python-code">
|
| 823 |
+
<div class="code-example">
|
| 824 |
+
import requests
|
| 825 |
+
|
| 826 |
+
url = "${req.protocol}://${req.get('host')}/hf/v1/chat/completions"
|
| 827 |
+
headers = {
|
| 828 |
+
"Content-Type": "application/json",
|
| 829 |
+
"Authorization": "Bearer user_your_cookie_value"
|
| 830 |
+
}
|
| 831 |
+
payload = {
|
| 832 |
+
"model": "claude-3.7-sonnet",
|
| 833 |
+
"messages": [
|
| 834 |
+
{"role": "user", "content": "Hello, who are you?"}
|
| 835 |
+
],
|
| 836 |
+
"temperature": 0.7
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
response = requests.post(url, headers=headers, json=payload)
|
| 840 |
+
data = response.json()
|
| 841 |
+
print(data)
|
| 842 |
+
<button class="copy-btn" title="Copy to clipboard">📋</button>
|
| 843 |
+
</div>
|
| 844 |
+
</div>
|
| 845 |
+
|
| 846 |
+
<div class="code-tab" id="curl-code">
|
| 847 |
+
<div class="code-example">
|
| 848 |
+
curl -X POST "${req.protocol}://${req.get('host')}/hf/v1/chat/completions" \\
|
| 849 |
+
-H "Content-Type: application/json" \\
|
| 850 |
+
-H "Authorization: Bearer user_your_cookie_value" \\
|
| 851 |
+
-d '{
|
| 852 |
+
"model": "claude-3.7-sonnet",
|
| 853 |
+
"messages": [
|
| 854 |
+
{"role": "user", "content": "Hello, who are you?"}
|
| 855 |
+
],
|
| 856 |
+
"temperature": 0.7
|
| 857 |
+
}'
|
| 858 |
+
<button class="copy-btn" title="Copy to clipboard">📋</button>
|
| 859 |
+
</div>
|
| 860 |
+
</div>
|
| 861 |
+
</div>
|
| 862 |
+
</div>
|
| 863 |
+
|
| 864 |
+
<!-- API Tester Tab -->
|
| 865 |
+
<div class="tab-content" id="tester-tab">
|
| 866 |
+
<h2>API Tester</h2>
|
| 867 |
+
|
| 868 |
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem;">
|
| 869 |
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
| 870 |
+
<div class="guide-step">
|
| 871 |
+
<h4>Request</h4>
|
| 872 |
+
<div style="margin-top: 0.5rem;">
|
| 873 |
+
<label for="api-key" style="display: block; margin-bottom: 0.25rem;">API Key:</label>
|
| 874 |
+
<input type="password" id="api-key" placeholder="user_..." style="width: 100%; padding: 0.5rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 4px; color: var(--text-primary);">
|
| 875 |
+
</div>
|
| 876 |
+
|
| 877 |
+
<div style="margin-top: 0.5rem;">
|
| 878 |
+
<label for="model-select" style="display: block; margin-bottom: 0.25rem;">Model:</label>
|
| 879 |
+
<select id="model-select" style="width: 100%; padding: 0.5rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 4px; color: var(--text-primary);">
|
| 880 |
+
<option value="claude-3.7-sonnet">claude-3.7-sonnet</option>
|
| 881 |
+
</select>
|
| 882 |
+
</div>
|
| 883 |
+
|
| 884 |
+
<div style="margin-top: 0.5rem;">
|
| 885 |
+
<label for="prompt-input" style="display: block; margin-bottom: 0.25rem;">Prompt:</label>
|
| 886 |
+
<textarea id="prompt-input" placeholder="Enter your prompt here..." style="width: 100%; height: 120px; padding: 0.5rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 4px; color: var(--text-primary); resize: vertical;">Hello, can you introduce yourself?</textarea>
|
| 887 |
+
</div>
|
| 888 |
+
|
| 889 |
+
<div style="margin-top: 0.5rem; display: flex; gap: 0.5rem; align-items: center;">
|
| 890 |
+
<label for="temperature" style="flex-shrink: 0;">Temperature:</label>
|
| 891 |
+
<input type="range" id="temperature" min="0" max="1" step="0.1" value="0.7" style="flex-grow: 1;">
|
| 892 |
+
<span id="temperature-value">0.7</span>
|
| 893 |
+
</div>
|
| 894 |
+
|
| 895 |
+
<button id="submit-api" style="margin-top: 1rem; width: 100%; padding: 0.75rem; background: var(--accent-color); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: 500; transition: var(--transition);">Send Request</button>
|
| 896 |
+
</div>
|
| 897 |
+
</div>
|
| 898 |
+
|
| 899 |
+
<div class="guide-step">
|
| 900 |
+
<h4>Response</h4>
|
| 901 |
+
<div style="height: 300px; overflow-y: auto; margin-top: 0.5rem; padding: 0.75rem; background: var(--bg-tertiary); border-radius: 4px; font-family: monospace; white-space: pre-wrap; font-size: 0.8rem;" id="api-response">
|
| 902 |
+
Response will appear here...
|
| 903 |
+
</div>
|
| 904 |
+
</div>
|
| 905 |
</div>
|
| 906 |
</div>
|
| 907 |
</div>
|
| 908 |
+
</main>
|
| 909 |
</div>
|
| 910 |
|
| 911 |
<script>
|
| 912 |
+
// Theme Toggle
|
| 913 |
const themeToggle = document.getElementById('theme-toggle');
|
| 914 |
|
| 915 |
// Check system preference
|
|
|
|
| 918 |
themeToggle.checked = true;
|
| 919 |
}
|
| 920 |
|
| 921 |
+
// Toggle theme
|
| 922 |
themeToggle.addEventListener('change', function() {
|
| 923 |
if (this.checked) {
|
| 924 |
document.documentElement.setAttribute('data-theme', 'dark');
|
|
|
|
| 927 |
}
|
| 928 |
});
|
| 929 |
|
| 930 |
+
// Mobile Menu Toggle
|
| 931 |
+
const menuToggle = document.getElementById('menu-toggle');
|
| 932 |
+
const sidebar = document.getElementById('sidebar');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 933 |
|
| 934 |
+
if (menuToggle) {
|
| 935 |
+
menuToggle.addEventListener('click', function() {
|
| 936 |
+
sidebar.classList.toggle('active');
|
| 937 |
+
});
|
| 938 |
+
}
|
| 939 |
|
| 940 |
+
// Main Tab Navigation
|
| 941 |
+
const tabButtons = document.querySelectorAll('.tab-button');
|
| 942 |
+
const tabContents = document.querySelectorAll('.tab-content');
|
| 943 |
+
const navItems = document.querySelectorAll('.nav-item');
|
| 944 |
+
|
| 945 |
+
function setActiveTab(tabId) {
|
| 946 |
+
// Deactivate all tabs
|
| 947 |
+
tabButtons.forEach(button => button.classList.remove('active'));
|
| 948 |
+
tabContents.forEach(content => content.classList.remove('active'));
|
| 949 |
+
navItems.forEach(item => item.classList.remove('active'));
|
| 950 |
+
|
| 951 |
+
// Activate the selected tab
|
| 952 |
+
const tabButton = document.querySelector('.tab-button[data-tab="' + tabId + '"]');
|
| 953 |
+
if (tabButton) {
|
| 954 |
+
tabButton.classList.add('active');
|
| 955 |
+
}
|
| 956 |
+
|
| 957 |
+
const tabContent = document.getElementById(tabId + '-tab');
|
| 958 |
+
if (tabContent) {
|
| 959 |
+
tabContent.classList.add('active');
|
| 960 |
+
}
|
| 961 |
+
|
| 962 |
+
const navItem = document.querySelector('.nav-item[data-tab="' + tabId + '"]');
|
| 963 |
+
if (navItem) {
|
| 964 |
+
navItem.classList.add('active');
|
| 965 |
+
}
|
| 966 |
}
|
| 967 |
|
| 968 |
+
// Set up tab click handlers
|
| 969 |
+
tabButtons.forEach(button => {
|
| 970 |
+
button.addEventListener('click', function() {
|
| 971 |
+
const tabId = this.getAttribute('data-tab');
|
| 972 |
+
setActiveTab(tabId);
|
| 973 |
+
});
|
| 974 |
+
});
|
| 975 |
|
| 976 |
+
// Set up nav item click handlers
|
| 977 |
+
navItems.forEach(item => {
|
| 978 |
+
item.addEventListener('click', function() {
|
| 979 |
+
const tabId = this.getAttribute('data-tab');
|
| 980 |
+
setActiveTab(tabId);
|
|
|
|
| 981 |
|
| 982 |
+
// Close mobile menu if open
|
| 983 |
+
if (window.innerWidth < 769) {
|
| 984 |
+
sidebar.classList.remove('active');
|
| 985 |
}
|
| 986 |
+
});
|
| 987 |
+
});
|
| 988 |
+
|
| 989 |
+
// Code example tabs
|
| 990 |
+
const codeTabButtons = document.querySelectorAll('[data-code-tab]');
|
| 991 |
+
const codeTabs = document.querySelectorAll('.code-tab');
|
| 992 |
+
|
| 993 |
+
codeTabButtons.forEach(button => {
|
| 994 |
+
button.addEventListener('click', function() {
|
| 995 |
+
codeTabButtons.forEach(btn => btn.classList.remove('active'));
|
| 996 |
+
codeTabs.forEach(tab => tab.classList.remove('active'));
|
| 997 |
|
| 998 |
+
const tabId = this.getAttribute('data-code-tab');
|
| 999 |
this.classList.add('active');
|
| 1000 |
|
| 1001 |
+
const codeTab = document.getElementById(tabId + '-code');
|
| 1002 |
+
if (codeTab) {
|
| 1003 |
+
codeTab.classList.add('active');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1004 |
}
|
| 1005 |
});
|
| 1006 |
+
});
|
| 1007 |
+
|
| 1008 |
+
// Copy buttons
|
| 1009 |
+
document.querySelectorAll('.copy-btn').forEach(button => {
|
| 1010 |
+
button.addEventListener('click', function() {
|
| 1011 |
+
const codeBlock = this.parentElement;
|
| 1012 |
+
const code = codeBlock.textContent.trim();
|
| 1013 |
+
|
| 1014 |
+
navigator.clipboard.writeText(code).then(() => {
|
| 1015 |
+
this.textContent = '✓';
|
| 1016 |
+
setTimeout(() => {
|
| 1017 |
+
this.textContent = '📋';
|
| 1018 |
+
}, 1500);
|
| 1019 |
+
});
|
| 1020 |
+
});
|
| 1021 |
+
});
|
| 1022 |
+
|
| 1023 |
+
// Get and display endpoint URL
|
| 1024 |
+
const url = new URL(window.location.href);
|
| 1025 |
+
const link = url.protocol + '//' + url.host + '/hf/v1';
|
| 1026 |
+
|
| 1027 |
+
// Update all endpoint URL displays
|
| 1028 |
+
document.querySelectorAll('#endpoint-url, #endpoint-guide').forEach(el => {
|
| 1029 |
+
el.textContent = link;
|
| 1030 |
+
});
|
| 1031 |
+
|
| 1032 |
+
const endpointShorthand = document.getElementById('endpoint-shorthand');
|
| 1033 |
+
if (endpointShorthand) {
|
| 1034 |
+
endpointShorthand.textContent = link + '/chat/completions';
|
| 1035 |
+
}
|
| 1036 |
+
|
| 1037 |
+
// Temperature slider
|
| 1038 |
+
const temperatureSlider = document.getElementById('temperature');
|
| 1039 |
+
const temperatureValue = document.getElementById('temperature-value');
|
| 1040 |
+
|
| 1041 |
+
if (temperatureSlider) {
|
| 1042 |
+
temperatureSlider.addEventListener('input', function() {
|
| 1043 |
+
temperatureValue.textContent = this.value;
|
| 1044 |
+
});
|
| 1045 |
}
|
| 1046 |
|
| 1047 |
// Load models list
|
| 1048 |
fetch('/hf/v1/models')
|
| 1049 |
.then(response => response.json())
|
| 1050 |
.then(data => {
|
| 1051 |
+
// Update model counts
|
| 1052 |
+
const modelCount = document.getElementById('model-count');
|
| 1053 |
+
if (modelCount) {
|
| 1054 |
+
modelCount.textContent = data.data.length;
|
| 1055 |
+
}
|
| 1056 |
+
|
| 1057 |
+
// Count models by category
|
| 1058 |
+
let claudeCount = 0;
|
| 1059 |
+
let gptCount = 0;
|
| 1060 |
+
let geminiCount = 0;
|
| 1061 |
+
let otherCount = 0;
|
| 1062 |
+
|
| 1063 |
+
data.data.forEach(model => {
|
| 1064 |
+
if (model.id.includes('claude')) claudeCount++;
|
| 1065 |
+
else if (model.id.includes('gpt')) gptCount++;
|
| 1066 |
+
else if (model.id.includes('gemini')) geminiCount++;
|
| 1067 |
+
else otherCount++;
|
| 1068 |
});
|
| 1069 |
|
| 1070 |
+
const claudeCountEl = document.getElementById('claude-count');
|
| 1071 |
+
if (claudeCountEl) {
|
| 1072 |
+
claudeCountEl.textContent = claudeCount;
|
| 1073 |
+
}
|
| 1074 |
+
|
| 1075 |
+
const gptCountEl = document.getElementById('gpt-count');
|
| 1076 |
+
if (gptCountEl) {
|
| 1077 |
+
gptCountEl.textContent = gptCount;
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
const geminiCountEl = document.getElementById('gemini-count');
|
| 1081 |
+
if (geminiCountEl) {
|
| 1082 |
+
geminiCountEl.textContent = geminiCount;
|
| 1083 |
+
}
|
| 1084 |
|
| 1085 |
+
const otherCountEl = document.getElementById('other-count');
|
| 1086 |
+
if (otherCountEl) {
|
| 1087 |
+
otherCountEl.textContent = otherCount;
|
| 1088 |
+
}
|
|
|
|
| 1089 |
|
| 1090 |
+
// Featured models (for dashboard)
|
| 1091 |
+
const featuredModels = ['claude-3.7-sonnet', 'gpt-4o', 'claude-3.5-sonnet', 'gemini-1.5-flash-500k'];
|
| 1092 |
+
const featuredContainer = document.getElementById('featured-models');
|
| 1093 |
+
if (featuredContainer) {
|
| 1094 |
+
featuredContainer.innerHTML = '';
|
| 1095 |
|
| 1096 |
+
featuredModels.forEach(modelId => {
|
| 1097 |
+
const found = data.data.find(m => m.id === modelId);
|
| 1098 |
+
if (found) {
|
| 1099 |
+
const modelEl = document.createElement('div');
|
| 1100 |
+
modelEl.className = 'model-tag';
|
| 1101 |
+
modelEl.textContent = found.id;
|
| 1102 |
+
featuredContainer.appendChild(modelEl);
|
| 1103 |
+
}
|
| 1104 |
+
});
|
| 1105 |
+
}
|
| 1106 |
+
|
| 1107 |
+
// All models
|
| 1108 |
+
const allModelsContainer = document.getElementById('all-models');
|
| 1109 |
+
if (allModelsContainer) {
|
| 1110 |
+
allModelsContainer.innerHTML = '';
|
| 1111 |
|
| 1112 |
+
// Sort models alphabetically
|
| 1113 |
+
data.data.sort((a, b) => a.id.localeCompare(b.id));
|
| 1114 |
+
|
| 1115 |
+
data.data.forEach(model => {
|
| 1116 |
+
const modelEl = document.createElement('div');
|
| 1117 |
+
modelEl.className = 'model-tag';
|
| 1118 |
+
modelEl.textContent = model.id;
|
| 1119 |
+
allModelsContainer.appendChild(modelEl);
|
| 1120 |
+
|
| 1121 |
+
// Add to model select dropdown
|
| 1122 |
+
const modelSelect = document.getElementById('model-select');
|
| 1123 |
+
if (modelSelect) {
|
| 1124 |
+
const option = document.createElement('option');
|
| 1125 |
+
option.value = model.id;
|
| 1126 |
+
option.textContent = model.id;
|
| 1127 |
+
modelSelect.appendChild(option);
|
| 1128 |
+
}
|
| 1129 |
+
});
|
| 1130 |
+
}
|
| 1131 |
})
|
| 1132 |
+
.catch(err => {
|
| 1133 |
const allModelsEl = document.getElementById('all-models');
|
| 1134 |
+
if (allModelsEl) {
|
| 1135 |
+
allModelsEl.textContent = 'Failed to load models: ' + err.message;
|
| 1136 |
+
}
|
| 1137 |
+
|
| 1138 |
+
const featuredModelsEl = document.getElementById('featured-models');
|
| 1139 |
+
if (featuredModelsEl) {
|
| 1140 |
+
featuredModelsEl.textContent = 'Failed to load models: ' + err.message;
|
| 1141 |
+
}
|
| 1142 |
});
|
| 1143 |
+
|
| 1144 |
+
// API Tester
|
| 1145 |
+
const submitApiBtn = document.getElementById('submit-api');
|
| 1146 |
+
if (submitApiBtn) {
|
| 1147 |
+
submitApiBtn.addEventListener('click', async function() {
|
| 1148 |
+
const apiKey = document.getElementById('api-key').value;
|
| 1149 |
+
const model = document.getElementById('model-select').value;
|
| 1150 |
+
const prompt = document.getElementById('prompt-input').value;
|
| 1151 |
+
const temperature = parseFloat(document.getElementById('temperature').value);
|
| 1152 |
+
|
| 1153 |
+
const responseContainer = document.getElementById('api-response');
|
| 1154 |
+
responseContainer.textContent = 'Loading...';
|
| 1155 |
+
|
| 1156 |
+
try {
|
| 1157 |
+
const response = await fetch(link + '/chat/completions', {
|
| 1158 |
+
method: 'POST',
|
| 1159 |
+
headers: {
|
| 1160 |
+
'Content-Type': 'application/json',
|
| 1161 |
+
'Authorization': 'Bearer ' + apiKey
|
| 1162 |
+
},
|
| 1163 |
+
body: JSON.stringify({
|
| 1164 |
+
model: model,
|
| 1165 |
+
messages: [{ role: 'user', content: prompt }],
|
| 1166 |
+
temperature: temperature
|
| 1167 |
+
})
|
| 1168 |
+
});
|
| 1169 |
+
|
| 1170 |
+
const data = await response.json();
|
| 1171 |
+
responseContainer.textContent = JSON.stringify(data, null, 2);
|
| 1172 |
+
} catch (error) {
|
| 1173 |
+
responseContainer.textContent = 'Error: ' + (error.message || 'Unknown error');
|
| 1174 |
+
}
|
| 1175 |
+
});
|
| 1176 |
+
}
|
| 1177 |
</script>
|
| 1178 |
</body>
|
| 1179 |
</html>
|