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.pyexamples/embeddings_basic.pyexamples/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
Metadata
Release files for langchain-telnyx 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_telnyx-1.0.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_telnyx-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / langchain_telnyx-1.0.0.tar.gz
| Download URL | langchain_telnyx-1.0.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
430e20ad41c955e4253954bfc830eb32213e6d69b41e3ed5e28b04bfc9f240b0
|
|
BLAKE2b-256 checksum How to use checksums |
da64b3479e79f7b6d26377a0ba7915a644aff7e6826aac6b9e23910a750fee38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / langchain_telnyx-1.0.0-py3-none-any.whl
| Download URL | langchain_telnyx-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c87901490a66fe248ef01402dddb06e3c9fa236ee0d3334f9139f5913e0e2f35
|
|
BLAKE2b-256 checksum How to use checksums |
386901c3a09c5554f2847fb0d22ef2c384a75922485acfd34badb48b0a51daeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|