Skip to main content
POST
TypeScript SDK

Authorizations

Authorization
string
header
required

Use an API key created in the NinjaChat developer console.

Headers

Idempotency-Key
string

Safely retry the same logical write without duplicate billing or execution.

Required string length: 1 - 255

Body

application/json
input
required
Minimum string length: 1
model
string
Required string length: 1 - 160
models
string[]
Required array length: 1 - 15 elements
Required string length: 1 - 160
instructions
string
max_output_tokens
integer

Maximum completion tokens, including reasoning where the provider counts it. Must fit the selected provider's output and context limits. Defaults to 2048 when omitted.

Required range: x <= 9007199254740991
temperature
number
Required range: 0 <= x <= 2
top_p
number
Required range: 0 <= x <= 1
stream
boolean
default:false
store
enum<boolean>
default:false
Available options:
false
tools
object[]
tool_choice
Available options:
none,
auto,
required
parallel_tool_calls
boolean
text
object
reasoning
object
routing
object
metadata
object
user
string
Maximum string length: 256

Response

Completed response or SSE stream.

id
string
required
object
enum<string>
required
Available options:
response
created_at
integer
required
status
enum<string>
required
Available options:
completed,
incomplete
error
null
required
incomplete_details
object | null
required
instructions
string | null
required
max_output_tokens
integer | null
required
model
string
required
Required string length: 1 - 160
output
object[]
required
output_text
string
required
parallel_tool_calls
boolean
required
previous_response_id
null
required
store
enum<boolean>
required
Available options:
false
usage
object
required
cost_usd
number
required
Required range: x >= 0
provider
string | null
required
request_id
string
required
routing
object
required
metadata
object
required