curl --request POST \
--url https://api.fish.audio/v1/agent/agents/<agent-id>/llm/custom/test \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test', 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.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test"
req, _ := http.NewRequest("POST", 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.post("https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"latency_ms": 123,
"status_code": 123,
"streams_content": false,
"tools_sent": 0,
"tool_calls_returned": 0,
"ttft_ms": 123,
"error": "<string>",
"type": "http_error",
"reason": "dns_failed"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}Test Voice Agent Custom LLM Endpoint
Check that the custom LLM saved on the agent’s draft works before you publish
curl --request POST \
--url https://api.fish.audio/v1/agent/agents/<agent-id>/llm/custom/test \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test', 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.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test"
req, _ := http.NewRequest("POST", 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.post("https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/v1/agent/agents/{agent_id}/llm/custom/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"latency_ms": 123,
"status_code": 123,
"streams_content": false,
"tools_sent": 0,
"tool_calls_returned": 0,
"ttft_ms": 123,
"error": "<string>",
"type": "http_error",
"reason": "dns_failed"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}llm.custom, using its base_url, model, API key and headers, with the draft’s system prompt and tools, and reports what came back. The request has no body.
The test reads the draft, so a change you save with Update Voice Agent Draft Config can be tested right away. Calls use the published version, so publish once the test passes. To test a different endpoint, save it to llm.custom first. An agent with no custom LLM, or one saved without an API key, returns 422, and so does a request body with any field.
A problem with your endpoint is not an HTTP error. An unreachable or blocked host, a timeout, a non-2xx reply, or a reply that isn’t a server-sent-event stream all return 200; read error and status_code to see what went wrong, not the HTTP status. To branch on the outcome, use type and reason. They take the same values as llm_endpoint_errors in Get Voice Agent Session, so an error you find here is the one you would see on a call. error is a readable explanation that can change, so don’t match on its text.
The test sends one turn and doesn’t retry. It waits up to 10 seconds for the response headers and 10 seconds for the first content, gives up after 20 seconds in total, reads at most 256 KB of the reply, and doesn’t follow redirects. Your key and custom headers are never logged or returned; if your endpoint’s reply quotes them, they are masked in error.
Each team can make 30 calls per minute to this endpoint. The 31st call within the same minute returns 429, and the count starts again in the next minute.
For setup in the console and the llm.custom fields, see Custom LLM.Authorizations
Response
Request fulfilled, document follows
Result of testing a custom LLM endpoint. A problem with your endpoint is
reported here, not as an HTTP error: error explains it and type and
reason name it.
Kind of failure, with the same values as type in a session's llm_endpoint_errors: http_error (your endpoint answered with a non-2xx status), timeout, connection_error (no answer) or invalid_response (a 2xx reply that was not usable). Null when the test succeeded.
http_error, timeout, connection_error, invalid_response Detail for connection_error and invalid_response, with the same values as reason in llm_endpoint_errors. For connection_error: dns_failed, connection_refused, connection_reset, tls_failed, address_not_allowed (an address Fish does not call) or unknown. For invalid_response: not_event_stream (the reply was not a stream), empty_reply (no text and no tool call) or unknown (the stream carried an error). Null otherwise.
dns_failed, connection_refused, connection_reset, tls_failed, address_not_allowed, not_event_stream, stream_incomplete, empty_reply, refused, unknown Was this page helpful?

