File size: 2,774 Bytes
11a10b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
105
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DuckDuckGo Chat API</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f4f4f4;
        }
        h1, h2 {
            color: #333;
        }
        code {
            background-color: #e4e4e4;
            padding: 2px 4px;
            border-radius: 4px;
        }
        pre {
            background-color: #e4e4e4;
            padding: 10px;
            border-radius: 4px;
            overflow-x: auto;
        }
        .endpoint {
            background-color: #fff;
            border: 1px solid #ddd;
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <h1>πŸ¦† DuckDuckGo Chat API</h1>
    
    <p>An OpenAI-compatible API for DuckDuckGo's AI chat functionality. Seamlessly integrate multiple AI models into your applications.</p>

    <h2>πŸš€ Available Endpoints</h2>

    <div class="endpoint">
        <h3>POST /v1/chat/completions</h3>
        <p>Generate chat completions using various AI models.</p>
        
        <h4>Request Body Example:</h4>
        <pre><code>{
    "model": "gpt-4o-mini",
    "messages": [
        {"role": "user", "content": "Hello, how are you?"}
    ],
    "stream": false
}</code></pre>

        <h4>Supported Models:</h4>
        <ul>
            <li>gpt-4o-mini</li>
            <li>claude-3-haiku</li>
            <li>llama-3.1-70b</li>
            <li>mixtral-8x7b</li>
        </ul>
    </div>

    <div class="endpoint">
        <h3>GET /v1/models</h3>
        <p>Retrieve a list of available AI models.</p>
    </div>

    <h2>πŸ› οΈ Features</h2>
    <ul>
        <li>OpenAI-compatible API</li>
        <li>Multiple AI model support</li>
        <li>Streaming and non-streaming responses</li>
        <li>Easy integration</li>
    </ul>

    <h2>πŸ“ Usage Example (Python)</h2>
    <pre><code>import requests

response = requests.post(
    'https://your-api-url.com/v1/chat/completions',
    json={
        "model": "gpt-4o-mini",
        "messages": [{"role": "user", "content": "Tell me a joke"}]
    }
)
print(response.json())</code></pre>

    <h2>πŸ™Œ Credits</h2>
    <p>
        Created by: Your Name<br>
        Powered by: 
        <a href="https://duckduckgo.com">DuckDuckGo</a> | 
        <a href="https://github.com/deedy5/duckduckgo_search">duckduckgo_search</a>
    </p>

    <footer>
        <p><small>Β© 2024 DuckDuckGo Chat API. All rights reserved.</small></p>
    </footer>
</body>
</html>