SDKs Overview
Official client libraries for GlyphNet.
Available SDKs
| Language | Package | Status |
|---|---|---|
| Python | glyphnet | Stable |
| JavaScript/TypeScript | @glyphnet/sdk | Stable |
| cURL | Native | N/A |
Quick Comparison
from glyphnet import GlyphNet
client = GlyphNet(api_key="gn_live_...")
result = client.verify("The Earth orbits the Sun")
print(f"Verified: {result.verified}")
print(f"Confidence: {result.confidence}")Features by SDK
| Feature | Python | JavaScript | cURL |
|---|---|---|---|
| Automatic retries | ✓ | ✓ | Manual |
| Rate limit handling | ✓ | ✓ | Manual |
| Type hints/TypeScript | ✓ | ✓ | N/A |
| Async support | ✓ | ✓ | N/A |
| Response models | ✓ | ✓ | JSON |
| Error classes | ✓ | ✓ | HTTP codes |
| Streaming | ✓ | ✓ | Manual |
Installation
Python
pip install glyphnetRequirements: Python 3.8+
JavaScript/TypeScript
npm install @glyphnet/sdk
# or
yarn add @glyphnet/sdk
# or
pnpm add @glyphnet/sdkRequirements: Node.js 16+
Configuration
Environment Variables
All SDKs support environment variable configuration:
export GLYPHNET_API_KEY="gn_live_..."
export GLYPHNET_BASE_URL="https://api.glyphnet.io" # Optional
export GLYPHNET_TIMEOUT="30000" # Optional, millisecondsClient Options
from glyphnet import GlyphNet
client = GlyphNet(
api_key="gn_live_...",
base_url="https://api.glyphnet.io", # Optional
timeout=30.0, # Optional, seconds
max_retries=3, # Optional
)Error Handling
All SDKs provide typed error classes:
from glyphnet import GlyphNet
from glyphnet.errors import (
AuthenticationError,
RateLimitError,
QuotaExceededError,
ValidationError,
APIError
)
client = GlyphNet()
try:
result = client.verify(text)
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except QuotaExceededError:
print("Monthly quota exceeded")
except ValidationError as e:
print(f"Invalid request: {e.message}")
except APIError as e:
print(f"API error: {e.status_code}")Response Types
Both SDKs provide strongly-typed response objects:
VerificationResult
interface VerificationResult {
requestId: string;
text: string;
claims: Claim[];
flagged: boolean;
summary: {
totalClaims: number;
verified: number;
unverified: number;
avgConfidence: number;
};
processingTimeMs: number;
}
interface Claim {
text: string;
verified: boolean;
confidence: number;
sources?: string[];
}Choosing an SDK
Use Python when:
- Building backend services
- Data processing pipelines
- Machine learning workflows
- Scripts and automation
Use JavaScript when:
- Node.js backend services
- Serverless functions (Vercel, AWS Lambda)
- Full-stack TypeScript applications
- Browser-based verification (via backend proxy)
Use cURL when:
- Quick testing and debugging
- Shell scripts
- CI/CD pipelines
- Learning the API