Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

langbly-python

PyPI Python License: MIT

Official Python SDK for the Langbly translation API — a drop-in replacement for Google Translate v2, powered by LLMs.

5-10x cheaper than Google Translate · Better quality · Switch in one PR

Installation

pip install langbly

Quick Start

from langbly import Langbly

client = Langbly(api_key="your-api-key")

# Translate text
result = client.translate("Hello world", target="nl")
print(result.text)  # "Hallo wereld"

# Batch translate
results = client.translate(["Hello", "Goodbye"], target="nl")
for r in results:
    print(r.text)

# Detect language
detection = client.detect("Bonjour le monde")
print(detection.language)  # "fr"

# List supported languages
languages = client.languages(target="en")

Migrate from Google Translate

Already using google-cloud-translate? Switching takes 2 minutes:

# Before (Google Translate)
from google.cloud import translate_v2 as translate
client = translate.Client()
result = client.translate("Hello", target_language="nl")

# After (Langbly) — same concepts, better translations, 5x cheaper
from langbly import Langbly
client = Langbly(api_key="your-key")
result = client.translate("Hello", target="nl")

→ Full migration guide: langbly.com/docs/migrate-google

Features

  • Google Translate v2 API compatible — same endpoint format
  • Auto-retry — exponential backoff on 429/5xx with Retry-After support
  • Typed errors — RateLimitError, AuthenticationError, LangblyError
  • Batch translation — translate multiple texts in one request
  • Language detection — automatic source language identification
  • HTML support — translate HTML while preserving tags
  • Context manager — use with for automatic cleanup

Error Handling

from langbly import Langbly, RateLimitError, AuthenticationError

client = Langbly(api_key="your-key")

try:
    result = client.translate("Hello", target="nl")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")

API Reference

Langbly(api_key, base_url=None, timeout=30.0, max_retries=2)

Create a client instance.

  • api_key (str): Your Langbly API key — get one free
  • base_url (str, optional): Override the API URL (default: https://api.langbly.com)
  • timeout (float, optional): Request timeout in seconds (default: 30)
  • max_retries (int, optional): Retries for transient errors (default: 2)

client.translate(text, target, source=None, format=None)

  • text (str | list[str]): Text(s) to translate
  • target (str): Target language code (e.g., "nl", "de", "fr")
  • source (str, optional): Source language code (auto-detected if omitted)
  • format (str, optional): "text" or "html"

client.detect(text)

  • text (str): Text to analyze

client.languages(target=None)

  • target (str, optional): Language code to return names in

License

MIT

Metadata

Release files for langbly 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for langbly 0.2.0
File Size Uploaded Provenance Actions
langbly-0.2.0.tar.gz 6.4 kB Without provenance Details for langbly-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langbly 0.2.0
File Interpreter ABI Platform Actions
langbly-0.2.0-py3-none-any.whl Python 3 none any Details for langbly-0.2.0-py3-none-any.whl

Total release size: 13.3 kB

Release files / langbly-0.2.0.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL langbly-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
935c1776d4728b98e23581e8613d13030b9ea613a3970bf295c52733e3dd0862
BLAKE2b-256 checksum
How to use checksums
043d2623026f0c69f5e9e8463b8c847418bf5809b9b6e49c4647de1ad1b50d77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / langbly-0.2.0-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL langbly-0.2.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8acacbe80b9c0e21f4354c424726b6a982442c243731b5ca840adeee4e5b9017
BLAKE2b-256 checksum
How to use checksums
28d674e43755be48c6287d7b509e7bb9a38d86e14b78159a91d3d54010f4a78d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Security for langbly 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.1.0 2 files With provenance
  • Added 0.2.0 2 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Loss of provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page