Endpoints
GET /api/health
POST /api/chat
Request body:
{
"message": "Write a short welcome message"
}
API Test Console
Send a prompt to /api/chat and inspect the text API response.
The homepage opens this test console. API calls stay available under /api.
GET /api/health
POST /api/chat
Request body:
{
"message": "Write a short welcome message"
}
<button id="send">Send</button>
<pre id="output"></pre>
<script>
document.getElementById("send").onclick = async () => {
const res = await fetch("/api/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
message: "Say hello in one sentence."
})
});
const data = await res.json();
document.getElementById("output").textContent =
data.response || data.error;
};
</script>
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TestApi {
public static void main(String[] args) throws Exception {
String body = """
{"message":"Say hello in one sentence."}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.guptchar.fun/api/chat"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
String response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString())
.body();
System.out.println(response);
}
}
import requests
url = "https://www.guptchar.fun/api/chat"
payload = {
"message": "Say hello in one sentence.",
}
response = requests.post(url, json=payload, timeout=60)
print(response.json())
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t writeCallback(char* ptr, size_t size, size_t nmemb, void* data) {
auto* output = static_cast<std::string*>(data);
output->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl = curl_easy_init();
std::string output;
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL,
"https://www.guptchar.fun/api/chat");
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,
"{\"message\":\"Say hello in one sentence.\"}");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &output);
curl_easy_perform(curl);
std::cout << output << std::endl;
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}