Clojure AI detector quickstart
Send at least 150 characters for a more reliable signal. The response score ranges from 0 (more likely human-written) to 1 (more likely AI-generated); use it as evidence, not proof.
No language-specific SDK is required. The example uses a standard or commonly used HTTP client to call Sapling's JSON API.
Clojure
/api/v1/aidetect
This example uses clj-http with JSON request and response support.
(require '[clj-http.client :as http])
(def api-key
(or (System/getenv "SAPLING_API_KEY")
(throw (ex-info "Set SAPLING_API_KEY first." {}))))
(def response
(http/post
"https://api.sapling.ai/api/v1/aidetect"
{:headers {"Authorization" (str "Bearer " api-key)}
:content-type :json
:accept :json
:form-params
{:text (str
"I am an artificial intelligence system designed to help people solve complex problems. "
"My capabilities include natural language processing, machine learning, and predictive analytics.")
:sent_scores true}
:as :json}))
(println (:body response))
Example response
application/json
{
"score": 0.9989,
"sentence_scores": [
{
"score": 0.9764,
"sentence": "I am an artificial intelligence system designed to help people solve complex problems."
},
{
"score": 0.9812,
"sentence": "My capabilities include natural language processing, machine learning, and predictive analytics."
}
],
"text": "I am an artificial intelligence system designed to help people solve complex problems. My capabilities include natural language processing, machine learning, and predictive analytics."
}
The overall score and sentence scores use different methods and may not match exactly. Choose thresholds based on the false-positive and false-negative costs of your use case.
About Clojure
Clojure is a dialect of Lisp, a class of programming languages that provide a macro system that treats code as mutable data. Clojure runs on the Java platform.