No project description provided
Project description
Pangram Labs Python Package
Installation
pip install pangram-sdk
Add your API key
Add your API key as an environment variable, or pass it directly to the Pangram constructor.
export PANGRAM_API_KEY=<your API key>
from pangram import Pangram
# If the environment variable PANGRAM_API_KEY is set:
pangram_client = Pangram()
# Otherwise, pass the API key directly:
my_api_key = '' # Fill this in with your API key.
pangram_client = Pangram(api_key=my_api_key)
Make a request
Basic prediction (scans first ~400 words of text, returns a single prediction):
from pangram import Pangram
pangram_client = Pangram()
result = pangram_client.predict_short(text)
# Score in range [0, 1] where 0 is human-written and 1 is AI-generated.
score = result['ai_likelihood']
Extended prediction (returns windows of AI/human text in a longer document)
from pangram import Pangram
pangram_client = Pangram()
result = pangram_client.predict_extended(text)
# Extended analysis with windowed results and detailed metrics
avg_score = result['avg_ai_likelihood']
max_score = result['max_ai_likelihood']
percent_ai = result['percent_ai']
Legacy predict method (calls predict_short internally):
from pangram import Pangram
pangram_client = Pangram()
result = pangram_client.predict(text)
# Score in range [0, 1] where 0 is human-written and 1 is AI-generated.
score = result['ai_likelihood']
Make a batch request
from pangram import Pangram
pangram_client = Pangram()
text_batch = ["abc", "def"]
results = pangram_client.batch_predict(text_batch)
for result in results:
text = result['text']
score = result['ai_likelihood']
Deprecated Methods
The following methods are deprecated and will be removed by April 1st, 2026:
predict_sliding_window()- Usepredict_extended()instead for better performancepredict_with_dashboard_link()- Usepredict_extendedwith the dashboard flag instead
Questions? Email support@pangram.com!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pangram_sdk-0.1.8.tar.gz.
File metadata
- Download URL: pangram_sdk-0.1.8.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6532b0a7ce7c6fae6548a1005bc8c7de1a80cb6673a1146cc76b924930734da7
|
|
| MD5 |
a3296e5ff99c8605f7fb0451a4fd3039
|
|
| BLAKE2b-256 |
24b7475c9f680004ddd80cec0dc0d3aa09e81027fd52ae8b16b31b47f501b42c
|
Provenance
The following attestation bundles were made for pangram_sdk-0.1.8.tar.gz:
Publisher:
publish-to-pypi.yml on pangramlabs/pangram-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pangram_sdk-0.1.8.tar.gz -
Subject digest:
6532b0a7ce7c6fae6548a1005bc8c7de1a80cb6673a1146cc76b924930734da7 - Sigstore transparency entry: 620646868
- Sigstore integration time:
-
Permalink:
pangramlabs/pangram-sdk@5357afdc95e820d0f462c1a6a01c82fafbf79fab -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/pangramlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@5357afdc95e820d0f462c1a6a01c82fafbf79fab -
Trigger Event:
push
-
Statement type:
File details
Details for the file pangram_sdk-0.1.8-py3-none-any.whl.
File metadata
- Download URL: pangram_sdk-0.1.8-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54a48a2441de1b30fb0fe32a3e4e6eba72859038e387ef134aa8303dac4fe087
|
|
| MD5 |
13ec3e7973151e0c0f309e1a39d3568e
|
|
| BLAKE2b-256 |
81ce1f5d85f6cb8f69fdd979f9be79c269b27d577e5257c68b71fa087f4fa87e
|
Provenance
The following attestation bundles were made for pangram_sdk-0.1.8-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on pangramlabs/pangram-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pangram_sdk-0.1.8-py3-none-any.whl -
Subject digest:
54a48a2441de1b30fb0fe32a3e4e6eba72859038e387ef134aa8303dac4fe087 - Sigstore transparency entry: 620646869
- Sigstore integration time:
-
Permalink:
pangramlabs/pangram-sdk@5357afdc95e820d0f462c1a6a01c82fafbf79fab -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/pangramlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@5357afdc95e820d0f462c1a6a01c82fafbf79fab -
Trigger Event:
push
-
Statement type: