Get Available Models
Returns the available models of a given type. Use it to find the
text-embedding and rerank models to configure on a knowledge base.1 min read
get/workspaces/current/models/model-types/{model_type}
Request example
curl --request GET \
--url https://api.dify.ai/v1/workspaces/current/models/model-types/{model_type} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.dify.ai/v1/workspaces/current/models/model-types/{model_type}"
headers = {
"Authorization": "Bearer <token>",
}
response = requests.request("GET", url, headers=headers)
print(response.text)const response = await fetch('https://api.dify.ai/v1/workspaces/current/models/model-types/{model_type}', {
method: 'GET',
headers: {
'Authorization': 'Bearer <token>'
}
});
const data = await response.json();
console.log(data);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.dify.ai/v1/workspaces/current/models/model-types/{model_type}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.dify.ai/v1/workspaces/current/models/model-types/{model_type}"
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))
}HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.dify.ai/v1/workspaces/current/models/model-types/{model_type}"))
.header("Authorization", "Bearer <token>")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());require 'uri'
require 'net/http'
url = URI('https://api.dify.ai/v1/workspaces/current/models/model-types/{model_type}')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = url.scheme == 'https'
request = Net::HTTP::Get.new(url)
request['Authorization'] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyResponse
{
"data": [
{
"icon_small": {
"en_US": "https://example.com/openai-small.svg",
"zh_Hans": "https://example.com/openai-small.svg"
},
"icon_small_dark": null,
"label": {
"en_US": "OpenAI",
"zh_Hans": "OpenAI"
},
"models": [
{
"deprecated": false,
"features": null,
"fetch_from": "predefined-model",
"has_invalid_load_balancing_configs": false,
"label": {
"en_US": "text-embedding-3-small",
"zh_Hans": "text-embedding-3-small"
},
"load_balancing_enabled": false,
"model": "text-embedding-3-small",
"model_properties": {
"context_size": 8191
},
"model_type": "text-embedding",
"status": "active"
}
],
"provider": "langgenius/openai/openai",
"status": "active",
"tenant_id": "11223344-5566-7788-99aa-bbccddeeff00"
}
]
}get/workspaces/current/models/model-types/{model_type}
Authorization
Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).
Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).
Path parameters
Type of model to retrieve. For knowledge base configuration, use
text-embedding for embedding models or rerank for reranking models.Options:
text-embeddingrerankllmttsspeech2textmoderationResponses
application/json
200
Available models for the specified type.
List of model providers with their available models.
Show child attributesHide child attributes
URL of the provider's small icon.
Dark-mode icon URLs;
null when the provider has none.Localized display name of the provider.
List of available models from this provider.
Show child attributesHide child attributes
Whether the model is deprecated.
Supported features of the model,
null if none.Where the model definition comes from.
predefined-model for built-in models, customizable-model for user-configured models.Whether the model has invalid load-balancing configurations.
Localized display name of the model.
Whether load balancing is enabled for the model.
Model identifier. Use this as the
embedding_model value when creating or updating a knowledge base.Model-specific properties such as
context_size.Type of the model, matching the
model_type path parameter.Model availability status.
active when ready to use.Model provider identifier, formatted as
organization/plugin_name/provider_name (e.g. langgenius/openai/openai). Legacy providers may return the bare short form (e.g. openai).Provider status.
active when credentials are configured and valid.Workspace ID the provider configuration belongs to.