Skip to main content

langchain-telnyx

An integration package connecting Telnyx AI Inference and LangChain.

Telnyx provides OpenAI-compatible LLMs hosted on its own GPU infrastructure. See the Available Models page for the full list.

Installation

pip install langchain-telnyx

Chat Models

from langchain_telnyx import ChatTelnyx

chat = ChatTelnyx(model="moonshotai/Kimi-K2.6")
response = chat.invoke("Hello!")

Embeddings

from langchain_telnyx import TelnyxEmbeddings

embeddings = TelnyxEmbeddings(model="thenlper/gte-large")
vectors = embeddings.embed_query("Hello world")

Configuration

Set the TELNYX_API_KEY environment variable with your Telnyx API key, or pass it via the api_key parameter.

Get an API key at telnyx.com.

By default, langchain-telnyx uses the following OpenAI-compatible base URL:

https://api.telnyx.com/v2/ai/openai

You can override it either with the base_url parameter or with the TELNYX_API_BASE environment variable.

Example:

from langchain_telnyx import ChatTelnyx

chat = ChatTelnyx(
    api_key="YOUR_API_KEY",
    base_url="https://api.telnyx.com/v2/ai/openai",
    model="moonshotai/Kimi-K2.6",
)

Supported Models

See Available Models — Telnyx Docs for the full, up-to-date list.

Chat Models

Model ID Parameters Context Best For
moonshotai/Kimi-K2.6 1.0T 256K Highest intelligence, voice AI (Recommended)
zai-org/GLM-5.1-FP8 753.9B 202K Reasoning, function calling
MiniMaxAI/MiniMax-M2.7 2M Cheapest, high intelligence

Embedding Models

Model ID Dimensions Best For
thenlper/gte-large 1024 Text embeddings

Examples

You can find runnable smoke examples in examples/:

  • examples/chat_basic.py
  • examples/embeddings_basic.py
  • examples/chat_with_env.py

To run them from a local clone:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
export TELNYX_API_KEY="your-api-key"
python examples/chat_basic.py
python examples/chat_with_env.py
python examples/embeddings_basic.py

Development

Run tests from a local clone:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install pytest pytest-asyncio langchain-core langchain-openai openai
python -m pytest -q

If you already have the virtual environment ready:

source .venv/bin/activate
python -m pytest -q

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_telnyx-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_telnyx-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_telnyx-1.0.0.tar.gz.

File metadata

  • Download URL: langchain_telnyx-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for langchain_telnyx-1.0.0.tar.gz
Algorithm Hash digest
SHA256 430e20ad41c955e4253954bfc830eb32213e6d69b41e3ed5e28b04bfc9f240b0
MD5 065f418b11cbe869484cdd4325d3078a
BLAKE2b-256 da64b3479e79f7b6d26377a0ba7915a644aff7e6826aac6b9e23910a750fee38

See more details on using hashes here.

File details

Details for the file langchain_telnyx-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: langchain_telnyx-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for langchain_telnyx-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c87901490a66fe248ef01402dddb06e3c9fa236ee0d3334f9139f5913e0e2f35
MD5 f029380a1ea9cab0cd87c949317072cb
BLAKE2b-256 386901c3a09c5554f2847fb0d22ef2c384a75922485acfd34badb48b0a51daeb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page