Skip to main content
GET
/
assistant
/
v1
/
models
Lists the available models
curl --request GET \
  --url https://api.langdock.com/assistant/v1/models \
  --header 'Authorization: Bearer <token>'
{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "created": 1686935735000,
      "owned_by": "system"
    },
    {
      "id": "gpt-4o-mini",
      "object": "model",
      "created": 1686935735000,
      "owned_by": "system"
    }
  ]
}
Retrieve the list of models and their ids, available for use with the Agent API. This endpoint is useful when you want to see which models you can use when creating a temporary agent.

Example Request

const axios = require("axios");

async function getAvailableModels() {
  try {
    const response = await axios.get("https://api.langdock.com/api/public/assistant/v1/models", {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
      },
    });

    console.log("Available models:", response.data.data);
  } catch (error) {
    console.error("Error fetching models:", error);
  }
}

Response Format

The API returns a list of available models in the following format:

Response Fields

object
string
Always ‘list’, indicating the top-level JSON object type.
data
array<Model>
Array containing available model objects.
id
string
Unique identifier of the model (e.g., gpt-5).
object
string
Always ‘model’, indicating the object type.
created
integer
Unix timestamp (ms) when the model was created.
owned_by
string
Owner of the model (currently always ‘system’).
Example response
{
  "object": "list",
  "data": [
    {
      "id": "gpt-5",
      "object": "model",
      "created": 1686935735000,
      "owned_by": "system"
    }
    // …other models
  ]
}

Error Handling

try {
  const response = await axios.get("https://api.langdock.com/api/public/assistant/v1/models", {
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
    },
  });
} catch (error) {
  if (error.response) {
    switch (error.response.status) {
      case 400:
        console.error("Invalid request parameters");
        break;
      case 500:
        console.error("Internal server error");
        break;
    }
  }
}
You can use any of these model IDs when creating a temporary agent through the Agent API. Simply specify the model ID in the model field of your agent configuration:
const response = await axios.post("https://api.langdock.com/api/public/assistant/v1/chat/completions", {
  assistant: {
    name: "Custom Agent",
    instructions: "You are a helpful agent",
    model: "gpt-5", // Specify the model ID here
  },
  messages: [
    { role: "user", content: "Hello!" },
  ],
});
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.

Authorizations

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Headers

Authorization
string
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Response

List of available models

object
enum<string>
required
Available options:
list
data
object[]
required