Passa al contenuto principale

Lista Modelli AI

L'API per l'ottenimento dei modelli di app.neoagent.co fornisce la funzionalità per creare un nuovo chatbot inviando una richiesta GET all'endpoint /chat/Chatbot/ModelList.

Endpoint

URL della Richiesta: https://app.neoagent.co/chat/Chatbot/ModelList
Metodo: GET

Headers richiesti

La richiesta API deve includere i seguenti header:

  • Authorization: <Your-Secret-Key> - string, obbligatorio - La chiave segreta per autenticare la richiesta API
  • Content-Type: application/json - string, obbligatorio - Il tipo di contenuto del payload della richiesta (deve essere application/json)

Esempi di Richiesta

const res = await fetch('https://app.neoagent.co/chat/Chatbot/ModelList', {
method: 'GET',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({})
});

const data = await res.json();
console.log(data);

Risposta

La risposta API sarà un oggetto JSON con la seguente struttura:

{
// array - List of knowledge items
"Data": [
{
"Key": "2",
"Value": "gpt-4o",
"Status": true
},
{
"Key": "3",
"Value": "gpt-4o-mini",
"Status": true
},
{
"Key": "22",
"Value": "claude-3.5-sonnet",
"Status": false
},
{
"Key": "23",
"Value": "claude-3.5-haiku",
"Status": false
}
],
// string - API version
"Version": "1.0.0",
// boolean - Operation success status
"Success": true,
// integer - HTTP status code
"Code": 200,
// string - Error message if any
"Message": ""
}

Gestione degli Errori

Se la richiesta fallisce, dovresti:

  1. Controllare il codice di stato HTTP per errori a livello di rete
  2. Esaminare i campi Code e Message nella risposta per errori a livello business
  3. Il campo Message conterrà informazioni dettagliate sull'errore