Skip to main content

cohere-tng

Python SDK for TNG — drop-in OHTTP encryption for httpx with TEE attestation verification. Built as a native Rust extension via PyO3.

Install

pip install cohere-tng

Usage

Sync

import httpx
import cohere_tng

transport = cohere_tng.Transport(verify={
    "model": "passport",
    "as_provider": "ita",
    "ita_jwks_addr": "https://portal.trustauthority.intel.com",
    "policy_ids": ["my-policy"],
})

with httpx.Client(transport=transport) as client:
    resp = client.get("https://api.example.com/v1/chat")
    print(resp.json())

    # Attestation token is available as a response header
    token = resp.headers.get("x-tng-attestation-token")

Async

import httpx
import cohere_tng

transport = cohere_tng.AsyncTransport(verify={
    "model": "passport",
    "as_provider": "ita",
    "ita_jwks_addr": "https://portal.trustauthority.intel.com",
    "policy_ids": ["my-policy"],
})

async with httpx.AsyncClient(transport=transport) as client:
    resp = await client.get("https://api.example.com/v1/chat")
    print(resp.json())

Response streaming

with httpx.Client(transport=transport) as client:
    with client.stream("POST", url, json=payload) as resp:
        for chunk in resp.iter_bytes():
            process(chunk)

Request streaming

Request bodies provided as generators are streamed through OHTTP without buffering the entire payload in memory:

def audio_chunks():
    with open("recording.wav", "rb") as f:
        while chunk := f.read(8192):
            yield chunk

with httpx.Client(transport=transport) as client:
    resp = client.post(url, content=audio_chunks())

Configuration

Both verify and ohttp follow the same schema as TNG's configuration.

  • verify (required) — Attestation verification config dict, or a list of them to accept a remote that attests in any one of those ways (see Multiple Verifiers). Pass None to explicitly disable verification — not recommended for production.
  • ohttp (optional) — OHTTP config dict (forward_headers, tls_ca_certs, etc.).

Development

python3 -m venv .venv
.venv/bin/pip install maturin httpx
.venv/bin/maturin develop
.venv/bin/pytest tests/

How it works

The cohere-tng package embeds TNG's Rust OHTTP implementation directly into the Python process via PyO3. When you make a request through cohere_tng.Transport:

  1. The TEE running the TNG egress is verified via remote attestation (e.g. Intel Trust Authority) before any data is sent.
  2. The request is encrypted using OHTTP (Oblivious HTTP) in-process.
  3. The encrypted payload is sent to the TNG egress inside the verified TEE.
  4. The egress decrypts and forwards the request to the actual backend.
  5. The response follows the reverse path, decrypted in-process before being returned to httpx. The attestation token is included as an x-tng-attestation-token response header.

Both request and response bodies are streamed — large payloads are never fully buffered in memory.

Acknowledgements

cohere-ai/tng is a fork of inclavare-containers/tng. Licensed under Apache-2.0.

Metadata

Release files for cohere-tng 1.6.1

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

Built distributions (wheels)

Table of built distributions (wheels) for cohere-tng 1.6.1
File Actions
cohere_tng-1.6.1-cp38-abi3-manylinux_2_28_aarch64.whl CPython 3.8 abi3 Linux glibc 2.28+ ARM64 Details for cohere_tng-1.6.1-cp38-abi3-manylinux_2_28_aarch64.whl
cohere_tng-1.6.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for cohere_tng-1.6.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
cohere_tng-1.6.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for cohere_tng-1.6.1-cp38-abi3-macosx_11_0_arm64.whl
cohere_tng-1.6.1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for cohere_tng-1.6.1-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 62.2 MB

Release files / cohere_tng-1.6.1-cp38-abi3-manylinux_2_28_aarch64.whl

Download URL cohere_tng-1.6.1-cp38-abi3-manylinux_2_28_aarch64.whl
Size 16.2 MB
Tags CPython 3.8 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
9fd14ce31e495e1c954faf11af6922972041e2e222781b168ded68f83cf6e240
BLAKE2b-256 checksum
How to use checksums
53a6ffcd668b78ab670e12646102b2df73a2b8b1ee3f50285d90f13e3a0212bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / cohere_tng-1.6.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL cohere_tng-1.6.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 16.4 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d3cefe743dd81e5201a20645e77b7db6d068ad5971aaad775a59528dd9706e9f
BLAKE2b-256 checksum
How to use checksums
a54c943685f1f58067a5b3db48225ca827d48861ba2ed5e11eaae7a33ec294e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / cohere_tng-1.6.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL cohere_tng-1.6.1-cp38-abi3-macosx_11_0_arm64.whl
Size 14.7 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9d690a74b0a68e1107150d156a8decc4df8e65544c87b4547d3d55ec303276de
BLAKE2b-256 checksum
How to use checksums
346a4dc9fbec76f6488f44df2b55a771d526dfb249a965910db05f00d97c0ee4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / cohere_tng-1.6.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL cohere_tng-1.6.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 14.9 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6afc08909e93682e65755ac49e346f4f8b6cfa952e18faed300624d6f7055a1a
BLAKE2b-256 checksum
How to use checksums
bc008328b8688a023e4be23d15e5334840d7a7304c54108346b952dee15db548
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for cohere-tng 1.6.1

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for cohere_tng-1.6.1-cp38-abi3-manylinux_2_28_aarch64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

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.

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