Lists the available models
curl --request GET \
--url https://api.langdock.com/agent/v1/models \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.langdock.com/agent/v1/models"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.langdock.com/agent/v1/models', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/agent/v1/models",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/models"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.langdock.com/agent/v1/models")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"id": "<string>",
"object": "<string>",
"created": 123,
"owned_by": "<string>"
}
]
}Agents API
Models for Agent API
Retrieve all available models for use with the Agent API.
GET
/
agent
/
v1
/
models
Lists the available models
curl --request GET \
--url https://api.langdock.com/agent/v1/models \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.langdock.com/agent/v1/models"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.langdock.com/agent/v1/models', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/agent/v1/models",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/models"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.langdock.com/agent/v1/models")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"id": "<string>",
"object": "<string>",
"created": 123,
"owned_by": "<string>"
}
]
}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.
You can use any of these model IDs when creating a temporary agent through the Agent API. Simply specify the model ID in the
Before You Start
- Legacy Assistants API: This is the new Agents API with native Vercel AI SDK compatibility. If you’re using the legacy Assistants API, see the migration guide.
Base URL
https://api.langdock.com/agent/v1/models
Dedicated deploymentsReplace
api.langdock.com with <your-deployment-url>/api/public in all requests.Example Request
const axios = require("axios");
async function getAvailableModels() {
try {
const response = await axios.get("https://api.langdock.com/agent/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
string
Always ‘list’, indicating the top-level JSON object type.
array<Model>
Array containing available model objects.
Model object fields
Model object fields
string
Model ID to use when creating or updating agents (e.g., “gpt-5”).
string
Always ‘model’, indicating the object type.
integer
Unix timestamp (ms) when the model was created.
string
Region where the model is available (e.g., “eu”, “us”, “global”).
boolean
Whether this model supports extended thinking mode.
Example response
{
"object": "list",
"data": [
{
"id": "gpt-5",
"object": "model",
"created": 1686935735000,
"region": "eu",
"supportsExtendedThinking": false
}
// …other models
]
}
Error Handling
try {
const response = await axios.get("https://api.langdock.com/agent/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 401:
console.error("Invalid API key");
break;
case 500:
console.error("Internal server error");
break;
}
}
}
model field of your agent configuration:
const response = await axios.post("https://api.langdock.com/agent/v1/chat/completions", {
agent: {
name: "Custom Agent",
instructions: "You are a helpful agent",
model: "gpt-5", // Specify the model ID here
},
messages: [
{ id: "msg_1", role: "user", parts: [{ type: "text", text: "Hello!" }] },
],
});
curl https://api.langdock.com/agent/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent": {
"name": "Custom Agent",
"instructions": "You are a helpful agent",
"model": "gpt-5"
},
"messages": [
{ "id": "msg_1", "role": "user", "parts": [{ "type": "text", "text": "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.
Was this page helpful?