Skip to main content
POST
/
serverless
/
v1
/
responses
Responses
curl --request POST \
  --url https://api.friendli.ai/serverless/v1/responses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "input": "Hello!",
  "model": "zai-org/GLM-5.2"
}
'
import requests

url = "https://api.friendli.ai/serverless/v1/responses"

payload = {
"input": "Hello!",
"model": "zai-org/GLM-5.2"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: 'Hello!', model: 'zai-org/GLM-5.2'})
};

fetch('https://api.friendli.ai/serverless/v1/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.friendli.ai/serverless/v1/responses"

payload := strings.NewReader("{\n \"input\": \"Hello!\",\n \"model\": \"zai-org/GLM-5.2\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
{
  "id": "resp_4b71d12c86d94e719c7e3984a7bb7941",
  "object": "response",
  "created_at": 1735722153,
  "status": "completed",
  "output": [
    {
      "type": "message",
      "id": "msg_4b71d12c86d94e719c7e3984a7bb7941",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Hello there, how may I assist you today?"
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 9,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 11,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 20
  },
  "model": "zai-org/GLM-5.2"
}
Generate a model response from text or image inputs. Follows the OpenAI Responses API format, with support for streaming, function and custom tool calls, structured outputs, and reasoning controls. See available models at this pricing table.
The Responses API may not be supported by all models available on Model APIs.
To request successfully, it is mandatory to enter a Personal API Key (e.g. flp_XXX) value in the Bearer Token field. Refer to the authentication section on our introduction page to learn how to acquire this variable and visit here to generate your API Key. When streaming mode is used (i.e., stream option is set to true), the response is in MIME type text/event-stream. Otherwise, the content type is application/json. You can view the schema of the streamed sequence of chunk objects in streaming mode here.
This API is currently in Beta. While we strive to provide a stable and reliable experience, this feature is still under active development. As a result, you may encounter unexpected behavior or limitations. We encourage you to provide feedback to help us improve the feature before its official release.

Authorizations

Authorization
string
header
required

When using Friendli Suite API for inference requests, you need to provide a Friendli Token for authentication and authorization purposes.

For more detailed information, please refer here.

Headers

X-Friendli-Team
string | null

ID of team to run requests as (optional parameter).

Body

application/json
input
required

Text or image inputs to the model, used to generate a response.

model
string
required

Code of the model to use. See available model list.

Example:

"zai-org/GLM-5.2"

instructions
string | null

A system (or developer) message inserted into the model's context.

max_output_tokens
integer | null

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

temperature
number | null

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

top_p
number | null

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.

parallel_tool_calls
boolean | null

Whether to allow the model to run tool calls in parallel.

tools
(Function · object | Custom · object)[] | null

An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

tool_choice

Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. An object can be used to force the model to call a specific function or custom tool.

Available options:
none,
auto,
required
text
ResponsesTextConfig · object | null

Configuration options for a text response from the model. Can be plain text or structured JSON data.

reasoning
ResponsesReasoningConfig · object | null

Configuration options for reasoning models.

stream
boolean | null
default:false

Whether to stream the generation result. When set to true, the response is sent as server-sent events once generated.

Response

Successfully generated a response.

id
string
required

Unique identifier for this response.

object
string
required

The object type of this resource - always set to response.

Allowed value: "response"
created_at
integer
required

Unix timestamp (in seconds) of when this response was created.

output
(Message · object | Reasoning · object | Function Tool Call · object)[]
required

An array of content items generated by the model.

error
ResponsesError · object | null

An error object returned when the model fails to generate a Response.

status
enum<string> | null

The status of the response generation. One of completed, failed, in_progress, cancelled, queued, or incomplete.

Available options:
completed,
failed,
in_progress,
cancelled,
queued,
incomplete
usage
ResponsesUsage · object | null

Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.

incomplete_details
ResponsesIncompleteDetails · object | null

Details about why the response is incomplete.

model
string | null

Model ID used to generate the response.

Last modified on July 10, 2026