File size: 3,359 Bytes
b63c874
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>E2B API Proxy</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }
        h1 {
            color: #2c3e50;
            border-bottom: 2px solid #3498db;
            padding-bottom: 10px;
        }
        h2 {
            color: #2980b9;
            margin-top: 30px;
        }
        pre {
            background-color: #f8f9fa;
            border: 1px solid #e9ecef;
            border-radius: 4px;
            padding: 15px;
            overflow-x: auto;
        }
        code {
            font-family: 'Courier New', Courier, monospace;
        }
        .endpoint {
            background-color: #e9f7fe;
            border-left: 4px solid #3498db;
            padding: 10px 15px;
            margin: 20px 0;
        }
        .method {
            font-weight: bold;
            color: #2980b9;
        }
        .url {
            color: #27ae60;
        }
        .button {
            display: inline-block;
            background-color: #3498db;
            color: white;
            padding: 10px 15px;
            text-decoration: none;
            border-radius: 4px;
            margin-top: 20px;
        }
        .button:hover {
            background-color: #2980b9;
        }
    </style>
</head>
<body>
    <h1>E2B API Proxy</h1>
    <p>This is a FastAPI implementation of an API proxy for E2B (fragments.e2b.dev). It provides a compatible interface for various AI model providers including OpenAI, Google, and Anthropic.</p>
    
    <h2>API Endpoints</h2>
    
    <div class="endpoint">
        <p><span class="method">GET</span> <span class="url">/hf/v1/models</span></p>
        <p>List available models</p>
        <pre><code>curl http://localhost:7860/hf/v1/models</code></pre>
    </div>
    
    <div class="endpoint">
        <p><span class="method">POST</span> <span class="url">/hf/v1/chat/completions</span></p>
        <p>Send chat completion requests</p>
        <pre><code>curl -X POST http://localhost:7860/hf/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-123456" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "Hello, how are you?"}
    ]
  }'</code></pre>
    </div>
    
    <div class="endpoint">
        <p><span class="method">GET</span> <span class="url">/health</span></p>
        <p>Health check endpoint</p>
        <pre><code>curl http://localhost:7860/health</code></pre>
    </div>
    
    <h2>Supported Models</h2>
    <p>The API supports various models from different providers:</p>
    <ul>
        <li><strong>OpenAI</strong>: o1-preview, o3-mini, gpt-4o, gpt-4.5-preview, gpt-4-turbo</li>
        <li><strong>Google</strong>: gemini-1.5-pro, gemini-2.5-pro-exp-03-25, gemini-exp-1121, gemini-2.0-flash-exp</li>
        <li><strong>Anthropic</strong>: claude-3-5-sonnet-latest, claude-3-7-sonnet-latest, claude-3-5-haiku-latest</li>
    </ul>
    
    <a href="https://github.com/yourusername/e2b-api-proxy" class="button">View on GitHub</a>
</body>
</html>