Skip to main content
The inference plane serves three endpoints. All of them authenticate with an AI Gateway token key (ltg_sk_...) issued through the management API. Telnyx account API keys, provider secrets and any other credential are rejected on this plane. Compatibility is bounded by the AI Gateway contract, not by every option the OpenAI and Anthropic SDKs expose; see Supported request fields and Supported Messages fields.

Models

These Telnyx-hosted models are billed to your Telnyx account. Use these model names in the model field:
  • Kimi-K3
  • Kimi-K2.6
  • Kimi-K2.5
  • GLM-5.3
  • GLM-5.3-Flash
  • GLM-5.2
  • GLM-5.1-FP8
  • MiniMax-M3-MXFP8
  • MiniMax-M2.7
  • Qwen3.8-27B
  • Qwen3-235B-A22B
  • DeepSeek-V4.1-Flash
  • DeepSeek-V4-Flash-0731
  • Llama-3.3-70B-Instruct
  • Meta-Llama-3.1-70B-Instruct
  • Meta-Llama-3.1-8B-Instruct
  • gemma-2b-it
A group lists the model names its keys may call in allowed_models; a key can narrow that list further. Per-request output and prompt limits are listed under Request size limits.

Bring-your-own-key models

These models run on your own provider account with a provider key and are billed by that provider. Add them to allowed_models like any other model. A BYOK model works only when the calling key’s group has an attached provider key for that model’s provider. Without one, requests fail with 503 and code enforcement_unavailable; they never fall back to a Telnyx-hosted model. Every BYOK model works on /v1/chat/completions. Anthropic BYOK models also work on /v1/messages.

Model discovery

GET /v1/models returns the models the supplied key may use: the intersection of the key’s allowed_models and its group’s list. It is not a global catalog, and it does not charge against any budget.

OpenAI SDK

Point the OpenAI SDK at the inference base URL and use the token key as the API key.
The optional user field attributes the request to an application end user for budgeting and reporting. See End-user identity.

Streaming

Set stream: true and consume the stream to completion. A stream that starts with HTTP 200 can still fail later; handle SDK exceptions and close the stream.

Anthropic SDK

POST /v1/messages is available only for Anthropic models used with your own Anthropic key (Anthropic BYOK models). A request to /v1/messages with a Telnyx-hosted model or an OpenAI BYOK model returns 400 with code invalid_request; call those models on /v1/chat/completions. Anthropic BYOK models work on both endpoints.
The Anthropic SDK appends /v1/messages to its base URL, so set the base URL to the gateway root without the /v1 suffix. The SDK sends the token key in x-api-key, which the gateway accepts. Authorization: Bearer is also accepted; if both headers are present they must carry the same token.
Raw HTTP requests must send anthropic-version: 2023-06-01; the SDKs add it automatically. metadata.user_id and the OpenAI user field identify the same end-user namespace. The endpoint streams standard Anthropic server-sent events (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop). An error after the stream has started arrives as an event: error frame.

Supported Messages fields

Content blocks of type text, tool_use and tool_result are supported. image blocks are rejected. OpenAI-specific fields (frequency_penalty, presence_penalty, n, seed, response_format, user, stream_options, parallel_tool_calls) are rejected on the Messages endpoint.

Retries and timeouts

Inference is not idempotent. An SDK retry after a timeout or disconnect can dispatch a second billed request, and a timeout is not evidence that the first request did no provider work. The examples on this page set max_retries=0; if your application retries, do so deliberately and only for errors that occurred before dispatch (for example 401, 403 or 429 with Retry-After). See Errors. Client-side timeouts are a client setting and do not extend the gateway’s server-side request lifetime.

Request size limits

Prompt size is measured conservatively from the request size, so the usable limit can be somewhat lower than the model’s tokenizer would count. A request over either limit returns 400. Set max_tokens (or max_completion_tokens) on every request, especially when the key, user or group has a low tpm_limit. A request without it reserves the model’s full output allowance against budgets and tpm_limit, and can be rate-limited even when the actual response would be short. See Reservations.

Supported request fields

Unknown top-level fields are rejected with 400. Options that a specific model does not support are also rejected with 400 rather than silently ignored.

Chat Completions

Image parts must be inline data:image/...;base64,... URLs (PNG, JPEG, GIF or WebP). Remote image URLs are rejected.

Not supported

  • Custom provider URLs, provider credentials, routing or fallback controls in the request body.
  • Remote image URLs.
  • Unlisted beta headers and options.
  • The Responses API, embeddings, image and audio generation, batches and realtime APIs. These are not part of the AI Gateway surface; see the Telnyx Inference API for those capabilities.