Description
Add a provider sample showing how to use Telnyx as an OpenAI-compatible endpoint with the existing OpenAIChatCompletionClient and OpenAIEmbeddingClient, following the same pattern as the existing Ollama sample.
Problem it solves:
Telnyx provides an OpenAI-compatible API at https://api.telnyx.com/v2/ai/openai that supports chat completions, embeddings, and function/tool calling. Users who want to use Telnyx as their inference provider currently have no reference sample showing how to configure the OpenAI clients with a custom base_url.
This follows the same pattern as the existing Ollama provider sample (python/samples/02-agents/providers/ollama/ollama_with_openai_chat_client.py).
Expected behavior:
Add a python/samples/02-agents/providers/telnyx/ directory with:
telnyx_chat_completion.py — Basic chat completion using OpenAIChatCompletionClient with Telnyx endpoint
telnyx_embeddings.py — Embeddings using OpenAIEmbeddingClient with Telnyx endpoint
telnyx_chat_completion_with_tools.py — Chat completion with function calling, demonstrating Telnyx telecom tools (SMS, number lookup, verify) via telnyx-agent-toolkit
README.md — Setup instructions, environment variables, and usage
All samples use the existing OpenAI provider clients — no new provider code is needed. The configuration is simply setting base_url and api_key:
client = OpenAIChatCompletionClient(
model="Kimi-K2.5",
api_key=os.getenv("TELNYX_API_KEY"),
base_url="https://api.telnyx.com/v2/ai/openai",
)
No public API changes. Pure docs + runnable samples only.
I checked the repository and did not find existing Telnyx issues, PRs, or sample references. If this direction fits the project, I can send a PR that follows python/samples/SAMPLE_GUIDELINES.md and the Python sample validation flow.
Code Sample
import asyncio
import os
from agent_framework import Agent
from agent_framework.openai import OpenAIChatCompletionClient
async def main() -> None:
client = OpenAIChatCompletionClient(
model="Kimi-K2.5",
api_key=os.getenv("TELNYX_API_KEY"),
base_url="https://api.telnyx.com/v2/ai/openai",
)
agent = Agent(chat_client=client, instructions="You are a helpful assistant.")
result = await agent.run("What is the capital of France?")
print(result)
if __name__ == "__main__":
asyncio.run(main())
Language/SDK
Python
Description
Add a provider sample showing how to use Telnyx as an OpenAI-compatible endpoint with the existing
OpenAIChatCompletionClientandOpenAIEmbeddingClient, following the same pattern as the existing Ollama sample.Problem it solves:
Telnyx provides an OpenAI-compatible API at
https://api.telnyx.com/v2/ai/openaithat supports chat completions, embeddings, and function/tool calling. Users who want to use Telnyx as their inference provider currently have no reference sample showing how to configure the OpenAI clients with a custombase_url.This follows the same pattern as the existing Ollama provider sample (
python/samples/02-agents/providers/ollama/ollama_with_openai_chat_client.py).Expected behavior:
Add a
python/samples/02-agents/providers/telnyx/directory with:telnyx_chat_completion.py— Basic chat completion usingOpenAIChatCompletionClientwith Telnyx endpointtelnyx_embeddings.py— Embeddings usingOpenAIEmbeddingClientwith Telnyx endpointtelnyx_chat_completion_with_tools.py— Chat completion with function calling, demonstrating Telnyx telecom tools (SMS, number lookup, verify) viatelnyx-agent-toolkitREADME.md— Setup instructions, environment variables, and usageAll samples use the existing OpenAI provider clients — no new provider code is needed. The configuration is simply setting
base_urlandapi_key:No public API changes. Pure docs + runnable samples only.
I checked the repository and did not find existing Telnyx issues, PRs, or sample references. If this direction fits the project, I can send a PR that follows
python/samples/SAMPLE_GUIDELINES.mdand the Python sample validation flow.Code Sample
Language/SDK
Python