Skip to main content
GET
/
ai
/
openai
/
models
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const response = await client.ai.openai.listModels();

console.log(response.data);
import os
from telnyx import Telnyx

client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.ai.openai.list_models()
print(response.data)
package main

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.AI.OpenAI.ListModels(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.openai.OpenAIListModelsParams;
import com.telnyx.sdk.models.ai.openai.OpenAIListModelsResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

OpenAIListModelsResponse response = client.ai().openai().listModels();
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

response = telnyx.ai.openai.list_models

puts(response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');

try {
$response = $client->ai->openai->listModels();

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx ai:openai list-models \
--api-key 'My API Key'
curl --request GET \
--url https://api.telnyx.com/v2/ai/openai/models \
--header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "id": "moonshotai/Kimi-K2.6",
      "created": "2023-11-07T05:31:56Z",
      "owned_by": "Telnyx",
      "organization": "moonshotai",
      "context_length": 262144,
      "languages": [
        "<string>"
      ],
      "parameters": 1000000000000,
      "license": "<string>",
      "object": "model",
      "base_model": "<string>",
      "task": "text-generation",
      "max_completion_tokens": 123,
      "parameters_str": "1.0T",
      "is_fine_tunable": false,
      "recommended_for_assistants": false,
      "is_vision_supported": false,
      "description": "<string>",
      "pricing": {
        "prompt": "0.300000",
        "completion": "1.200000",
        "cached_prompt": "0.060000",
        "currency": "USD",
        "unit": "1M_tokens"
      },
      "regions": [
        "us-central-1",
        "us-east-1"
      ]
    }
  ],
  "object": "list"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Response

Successful Response

data
ModelMetadata · object[]
required
object
string
default:list