Generate text
Run one stateless model generation at the requested location and return the assistant text. Uses the location’s default model when none is specified.
POST
/api/generateQuery parameters
locationobject | anyRequest body
requiredapplication/jsonpromptstringrequiredmodelModel.Ref | anyShow propertiesHide properties
Any of:
Model.Ref
idstringrequiredproviderIDstringrequiredvariantstringany
anyResponses
200GenerateTextResponse
dataobjectrequiredShow propertiesHide properties
textstringrequired400InvalidRequestError
Any of:
InvalidRequestError1
_tagstringrequiredAllowed:
InvalidRequestErrormessagestringrequiredkindstring | anyShow propertiesHide properties
Any of:
string
stringany
anyfieldstring | anyShow propertiesHide properties
Any of:
string
stringany
anyInvalidRequestError
_tagstringrequiredAllowed:
InvalidRequestErrormessagestringrequiredkindstring | anyShow propertiesHide properties
Any of:
string
stringany
anyfieldstring | anyShow propertiesHide properties
Any of:
string
stringany
any401UnauthorizedError
_tagstringrequiredAllowed:
UnauthorizedErrormessagestringrequired503ServiceUnavailableError
_tagstringrequiredAllowed:
ServiceUnavailableErrormessagestringrequiredservicestring | anyShow propertiesHide properties
Any of:
string
stringany
anyRequest
curl -X POST "/api/generate" \
-H "Content-Type: application/json" \
-d '{
"prompt": "string",
"model": {
"id": "string",
"providerID": "string",
"variant": "string"
}
}'const response = await fetch("/api/generate", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"prompt": "string",
"model": {
"id": "string",
"providerID": "string",
"variant": "string"
}
})
});import requests
response = requests.post(
"/api/generate",
headers={
"Content-Type": "application/json"
},
json={
"prompt": "string",
"model": {
"id": "string",
"providerID": "string",
"variant": "string"
}
},
)Response
{
"data": {
"text": "string"
}
}{
"_tag": "InvalidRequestError",
"message": "string",
"kind": "string",
"field": "string"
}{
"_tag": "UnauthorizedError",
"message": "string"
}{
"_tag": "ServiceUnavailableError",
"message": "string",
"service": "string"
}