Skip to main content

Chat Completions

Base URL: https://app.neuroflash.com/api/ds-prototypes

Generate text completions using AI models.

Chat Completions

POST/chat/completions

Handle chat completions with word counting and provider routing

Request Body

FieldTypeRequiredDescription
messagesarray<object>YesList of messages with 'role' and 'content'
modelstringYesName of the model
temperatureobjectNoTemperature of the model
max_tokensobjectNoLimit the number of tokens to generate
reasoningobjectNoParameters for the reasoning mode
reasoning_effortobjectNoLevel of the reasoning mode
toolsobjectNoFor tools & function calling
tool_choiceobjectNoInfluence tool selection
seedobjectNoRandom seed
response_formatobjectNoUsed for structured outputs to define a JSON schema
web_search_optionsobjectNoExtra options for WEB Search
structured_outputsobjectNo
frequency_penaltyobjectNoPenalizing option
presence_penaltyobjectNoPenalizing option
repetition_penaltyobjectNoPenalizing option
stopobjectNoCustomize stop condition
streamobjectNoEnable streaming mode

Example

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 -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
}'

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
}
}