telnyx-ai-inference-python

telnyx-ai-inference-python is a skill for Claude Code, Codex from team-telnyx/ai. It costs 35 tokens per session (6,748 once invoked), scanned A, a copy of telnyx-ai-inference-curl, MIT.

A Python guide for using Telnyx's cloud APIs for language-model inference, text embeddings, and call analysis. Telnyx is a communications service that also provides these AI features.

In plain words
What is it for?
Adding AI-generated text or embeddings to an application, and creating call summaries or insights through Telnyx's APIs.
Why use it?
It gives developers ready examples for connecting Python code to these services and handling common failures such as invalid keys, network errors, rate limits, and bad input.

Skill for Claude CodeCodex

Part of the telnyx-ai plugin — 13 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/team-telnyx/ai/telnyx-ai-inference-python
Any agent
npx skills add team-telnyx/ai --skill telnyx-ai-inference-python
Clone the repo
git clone --depth 1 https://github.com/team-telnyx/ai

Made for: Claude Code, Codex.

Or install telnyx-ai, the plugin that ships this one along with the rest of its 13 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for telnyx-ai-inference-python

README.md
[![agentmods](https://agentmods.dev/badge/skills/team-telnyx/ai/telnyx-ai-inference-python.svg)](https://agentmods.dev/skills/team-telnyx/ai/telnyx-ai-inference-python)
Your own site
<a href="https://agentmods.dev/skills/team-telnyx/ai/telnyx-ai-inference-python"><img src="https://agentmods.dev/badge/skills/team-telnyx/ai/telnyx-ai-inference-python.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,748 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 94% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00035 $0.06748
Opus 5 $0.00017 $0.03374
Sonnet 5 $0.00007 $0.01350
Haiku 4.5 $0.00003 $0.00675

Measured 5d ago against content hash a87ac09e33f1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

telnyx-ai-inference-python scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

94% identical to telnyx-ai-inference-curl — 568 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

providers/claude/plugins/telnyx-ai/skills/telnyx-ai-inference-python/SKILL.md · 785 lines

How it starts

The opening of the file, as written. The whole thing — 785 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Telnyx Ai Inference - Python

Installation

pip install telnyx

Setup

import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
)

All examples below assume client is already initialized as shown above.

Error Handling

All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:

import telnyx

try:
    result = client.messages.send(to="+13125550001", from_="+13125550002", text="Hello")
except telnyx.APIConnectionError:
    print("Network error — check connectivity and retry")
except telnyx.RateLimitError:
    # 429: rate limited — wait and retry with exponential backoff
    import time
    time.sleep(1)  # Check Retry-After header for actual delay
except telnyx.APIStatusError as e:
    print(f"API error {e.status_code}: {e.message}")
    if e.status_code == 422:
        print("Validation error — check required fields and formats")

Common error codes: 401 invalid API key, 403 insufficient permissions, 404 resource not found, 422 validation error (check field formats), 429 rate limited (retry with exponential backoff).

Important Notes

  • Pagination: List methods return an auto-paginating iterator. Use for item in page_result: to iterate through all pages automatically.

Transcribe speech to text

Transcribe speech to text. This endpoint is consistent with the OpenAI Transcription API and may be used with the OpenAI JS or Python SDK.

POST /ai/audio/transcriptions

response = client.ai.audio.transcribe(
    model="distil-whisper/distil-large-v2",
)
print(response.text)

Returns: duration (number), segments (array[object]), text (string), words (array[object])

Read the full file on GitHub · 785 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 785 lines · 35 tokens per session scan A a87ac09e33f1

Subscribe to this mod's changes

telnyx-ai-inference-python is a skill published in the GitHub repository team-telnyx/ai (212 stars, last pushed yesterday), licensed MIT. It adds 35 tokens to every session and 6,748 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 94% identical to telnyx-ai-inference-curl, differing in 568 lines, and is treated as a copy.