Agent API için modeller
Agent API ile kullanılabilecek tüm modelleri alın.
Agent API ile kullanılabilecek modellerin ve id'lerinin listesini döndürür. Geçici bir agent oluştururken hangi modelleri kullanabileceğinizi görmek için bu endpoint faydalıdır.
Başlamadan önce
- Legacy Assistants API: Bu, yerel Vercel AI SDK uyumluluğuna sahip yeni Agents API'dir. Eski Assistants API kullanıyorsanız migration guide sayfasına bakın.
Base URL
https://api.ajan.io/agent/v1/modelsDedicated deployments Tüm isteklerde
api.ajan.com'u/api/publicile değiştirin.
Example Request
const axios = require("axios");
async function getAvailableModels() {
try {
const response = await axios.get("https://api.ajan.io/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
API, kullanılabilir modelleri aşağıdaki biçimde döndürür:
Response Fields
Her zaman 'list' — üst düzey JSON nesne türünü belirtir.
Kullanılabilir model nesnelerini içeren dizi.
Model ID — agent oluştururken veya güncellerken kullanılır (ör. "gpt-5").
Her zaman 'model' — nesne türünü belirtir.
Modelin oluşturulduğu Unix zaman damgası (ms).
Modelin kullanılabildiği bölge (ör. "eu", "us", "global").
Bu modelin extended thinking modunu destekleyip desteklemediği.
{
"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.ajan.io/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;
}
}
}Agent API üzerinden geçici bir agent oluştururken bu model ID'lerinden herhangi birini kullanabilirsiniz. Agent yapılandırmanızdaki model alanına model ID'sini yazmanız yeterlidir:
const response = await axios.post("https://api.ajan.io/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.ajan.io/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!" }] }
]
}'ajan, API anahtarınızı korumak ve uygulamalarınızın güvenliğini sağlamak için tarayıcı kaynaklı istekleri bilinçli olarak engeller. Daha fazla bilgi için API Key Best Practices kılavuzuna bakın.
OpenAPI
openapi: 3.0.0
info:
title: ajan API
version: 3.0.0
servers:
- url: https://api.ajan.io
description: Production
security:
- bearerAuth: []
paths:
/agent/v1/models:
get:
tags:
- Agent
summary: Lists the available models
description: Returns a list of models that are available for use with the API.
parameters: []
responses:
'200':
description: List of available models
content:
application/json:
schema:
type: object
required:
- object
- data
properties:
object:
type: string
enum:
- list
data:
type: array
items:
type: object
properties:
id:
type: string
object:
type: string
created:
type: integer
owned_by:
type: string
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: API key as Bearer token. Format "Bearer YOUR_API_KEY"