Chat Completions
Base URL: https://app.neuroflash.com/api/ds-prototypes
Generate text completions using AI models.
Chat Completions
POST
/chat/completionsHandle chat completions with word counting and provider routing
Request Body
FieldTypeRequiredDescription
messagesarray<object>YesList of messages with 'role' and 'content'modelstringYesName of the modeltemperatureobjectNoTemperature of the modelmax_tokensobjectNoLimit the number of tokens to generatereasoningobjectNoParameters for the reasoning modereasoning_effortobjectNoLevel of the reasoning modetoolsobjectNoFor tools & function callingtool_choiceobjectNoInfluence tool selectionseedobjectNoRandom seedresponse_formatobjectNoUsed for structured outputs to define a JSON schemaweb_search_optionsobjectNoExtra options for WEB Searchstructured_outputsobjectNofrequency_penaltyobjectNoPenalizing optionpresence_penaltyobjectNoPenalizing optionrepetition_penaltyobjectNoPenalizing optionstopobjectNoCustomize stop conditionstreamobjectNoEnable streaming modeExample
Required header
All requests to /api/ds-prototypes require the x-workspace-id header in addition to
Authorization. Omitting it returns 400 Bad Request.
- cURL
- Python
- Node.js
- Go
curl -X POST "https://app.neuroflash.com/api/ds-prototypes/chat/completions" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{ "role": "user", "content": "Write a tagline for an AI content platform." }
],
"model": "openai/gpt-4.1-mini",
"temperature": 0.7
}'
import requests
response = requests.post(
f"https://app.neuroflash.com/api/ds-prototypes/chat/completions",
headers={"Authorization": f"Bearer {token}", "x-workspace-id": workspace_id, "Content-Type": "application/json"},
json={
"messages": [
{"role": "user", "content": "Write a tagline for an AI content platform."}
],
"model": "openai/gpt-4.1-mini",
"temperature": 0.7
},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/ds-prototypes/chat/completions`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"x-workspace-id": workspaceId,
"Content-Type": "application/json",
},
body: JSON.stringify({
messages: [
{ role: "user", content: "Write a tagline for an AI content platform." }
],
model: "openai/gpt-4.1-mini",
temperature: 0.7,
}),
}
).then((r) => r.json());
body, _ := json.Marshal(map[string]any{
"messages": []map[string]string{
{"role": "user", "content": "Write a tagline for an AI content platform."},
},
"model": "openai/gpt-4.1-mini",
"temperature": 0.7,
})
req, _ := http.NewRequest("POST", "https://app.neuroflash.com/api/ds-prototypes/chat/completions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("x-workspace-id", workspaceID)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{
"id": "gen-1775000000-AbCdEfGh",
"object": "chat.completion",
"model": "openai/gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Create smarter content, faster — powered by AI that knows your brand."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 12,
"total_tokens": 26,
"words_used": 9
}
}