ContentTrue SDK for Elixir
contenttrue_sdk is the official Elixir SDK for the ContentTrue AIGC
detection API. It helps developers submit long-form text and retrieve machine
generation probability scores from automated detection endpoints.
The package is intentionally lightweight:
- typed public structs for clients, responses, and errors
-
a thin request layer built on
Req - convenience helpers for text scoring and batch detection endpoints
- package metadata prepared for Hex publishing
Installation
Add the dependency to your mix.exs:
def deps do
[
{:contenttrue_sdk, "~> 0.1.0"}
]
endThen fetch dependencies:
mix deps.getQuick Start
client =
ContenttrueSDK.new(
api_key: System.fetch_env!("CONTENTTRUE_API_KEY")
)
{:ok, response} =
ContenttrueSDK.score_text(client, "This is the long text you want to inspect.")
response.status
response.bodyBuilt-In Helpers
Score a single text input:
ContenttrueSDK.score_text(client, "Evaluate whether this content looks AI-generated.")Submit a richer detection payload:
ContenttrueSDK.score_document(client, %{
text: "Long form content",
language: "en",
metadata: %{source: "editor"}
})Batch score multiple texts:
ContenttrueSDK.batch_score_texts(client, [
"First article body",
"Second article body"
])Configuration
The client accepts these options:
:api_key- API key used for authenticated requests:base_url- defaults tohttps://contenttrue.org:api_key_header- defaults to"authorization":api_key_prefix- defaults to"Bearer":headers- additional request headers:receive_timeout- request timeout in milliseconds:req_options- rawReqoptions merged into each request
Generic Requests
You can still call lower-level helpers for endpoints not yet wrapped:
ContenttrueSDK.get(client, "/v1/usage")ContenttrueSDK.request(client, :post, "/v1/detections/custom", body: %{text: "Sample"})Publishing Notes
Before the next public release, update these items:
-
replace the
@source_url_placeholderinmix.exswith the public repository URL - align helper paths with the production ContentTrue API contract
- expand tests around validation, large-payload handling, and score schemas
Official Links
- Homepage: https://contenttrue.org/en
- Official documentation and support: https://contenttrue.org/en
License
MIT