Docs
LLmHub API List Models
LLmHub API List Models
Official API documentation for LLmHub API (api.llmhub.dev)
This endpoint retrieves the list of currently available models and provides basic information about each model, including the owner and availability. For details on supported models and pricing, please refer to the Models & Pricing section.
HTTP Endpoint:
GET https://api.llmhub.dev/v1/models
Response
Status Code: 200 OK
Returns a JSON object containing a list of models.
Content-Type: application/json
Response Schema
- object
- data (required): An array of model objects. Each model object contains details such as the model's identifier, owner, and availability.
Example schema structure:
{
"data": [
{
"id": "llmhub-chat",
"owner": "LLMHUB",
"available": true
}
// ... additional model objects
]
}
Code Examples
cURL
curl -L -X GET 'https://api.llmhub.dev/v1/models' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'
Python
import requests
url = "https://api.llmhub.dev/v1/models"
headers = {
"Authorization": "Bearer <your_api_key>"
}
response = requests.get(url, headers=headers)
print(response.json())
Go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type Model struct {
ID string `json:"id"`
Owner string `json:"owner"`
Available bool `json:"available"`
}
type Response struct {
Data []Model `json:"data"`
}
func main() {
url := "https://api.llmhub.dev/v1/models"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer <your_api_key>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var res Response
json.Unmarshal(body, &res)
fmt.Printf("%+v\n", res.Data)
}
Node.js
const axios = require('axios');
axios.get('https://api.llmhub.dev/v1/models', {
headers: {
'Authorization': 'Bearer <your_api_key>'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
Ruby
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://api.llmhub.dev/v1/models")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer <your_api_key>"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts JSON.parse(response.body)
C#
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
class Program {
static async Task Main(string[] args) {
var url = "https://api.llmhub.dev/v1/models";
var apiKey = "<your_api_key>";
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var response = await client.GetAsync(url);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}
PHP
<?php
$apiKey = "<your_api_key>";
$url = "https://api.llmhub.dev/v1/models";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $apiKey"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>
Java
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
import org.json.JSONArray;
public class ListModels {
public static void main(String[] args) throws Exception {
String apiKey = "<your_api_key>";
URL url = new URL("https://api.llmhub.dev/v1/models");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "Bearer " + apiKey);
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
JSONObject jsonResponse = new JSONObject(response.toString());
JSONArray models = jsonResponse.getJSONArray("data");
System.out.println(models.toString());
}
}
PowerShell
$apiKey = "<your_api_key>"
$url = "https://api.llmhub.dev/v1/models"
$response = Invoke-RestMethod -Uri $url -Method Get -Headers @{
"Authorization" = "Bearer $apiKey"
}
$response.data