NinjaChat Presets API
The Presets API from NinjaChat — 1 operation(s) for presets.
The Presets API from NinjaChat — 1 operation(s) for presets.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/ninjachat-ai:ninjachat-ai-presets-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: NinjaChat Presets API
version: 1.0.0
description: Clean-break NinjaChat v1. Chat and Responses bill actual token usage; images and videos use catalog unit pricing.
servers:
- url: https://www.ninjachat.ai/api/v1
tags:
- name: Presets
paths:
/presets/{slug}/chat/completions:
post:
summary: Run a saved preset
description: Chat completion using a preset's saved model, routing, system prompt, and parameters. Send only your messages; pass model/models to override the preset's chain for this call. Response headers include X-Ninja-Preset and X-Ninja-Preset-Version.
security:
- bearerAuth: []
parameters:
- schema:
type: string
required: true
name: slug
in: path
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PresetChatCompletionsRequest'
responses:
'200':
description: Chat completion or SSE stream.
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionResponse'
text/event-stream:
schema:
type: string
'400':
description: Invalid or unsupported request parameter.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'402':
description: Insufficient balance or project spend limit reached.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No active preset with that slug on this account.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Gateway error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-codeSamples:
- lang: javascript
label: TypeScript SDK
source: "import { NinjaChat } from \"@ninjachat/sdk\";\n\nconst client = new NinjaChat({ apiKey: process.env.NINJACHAT_API_KEY! });\n\nconst completion = await client.chat.completions.create({\n model: \"@support\",\n messages: [{ role: \"user\", content: \"Help me reset my workspace.\" }],\n});"
- lang: python
label: Python SDK
source: "import os\nfrom ninjachat import NinjaChat\n\nclient = NinjaChat(api_key=os.environ[\"NINJACHAT_API_KEY\"])\n\ncompletion = client.chat.completions.create(\n model=\"@support\",\n messages=[{\"role\": \"user\", \"content\": \"Help me reset my workspace.\"}],\n)"
x-ninjachat-status: current
tags:
- Presets
operationId: postPresetsBySlugChatCompletions
x-operation-id-source: derived
components:
parameters:
IdempotencyKey:
name: Idempotency-Key
in: header
required: false
schema:
type: string
minLength: 1
maxLength: 255
description: Safely retry the same logical write without duplicate billing or execution.
schemas:
ErrorResponse:
type: object
properties:
error:
type: object
properties:
message:
type: string
type:
type: string
code:
type: string
param:
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
RoutingPolicy:
type: object
properties:
strategy:
type: string
enum:
- balanced
- cost
- latency
- quality
providers:
type: object
properties:
only:
type: array
items:
type: string
minLength: 1
maxLength: 128
minItems: 1
maxItems: 20
exclude:
type: array
items:
type: string
minLength: 1
maxLength: 128
minItems: 1
maxItems: 20
order:
type: array
items:
type: string
minLength: 1
maxLength: 128
minItems: 1
maxItems: 20
additionalProperties: false
allow_fallbacks:
type: boolean
default: true
require_parameters:
type: boolean
default: true
data_policy:
type: string
enum:
- default
- no_training
- zero_retention
default: default
caching:
type: string
enum:
- auto
max_cost_usd:
type: number
exclusiveMinimum: 0
maximum: 1000
additionalProperties: false
ChatReasoning:
type: object
properties:
effort:
type: string
enum:
- none
- minimal
- low
- medium
- high
- xhigh
max_tokens:
type: integer
minimum: 0
maximum: 9007199254740991
enabled:
type: boolean
additionalProperties: false
ProviderAttemptReceipt:
type: object
properties:
provider:
type: string
outcome:
type: string
enum:
- served
- failed_over
- failed
attempt_index:
type: integer
minimum: 0
required:
- provider
- outcome
- attempt_index
additionalProperties: false
RoutingSummary:
type: object
properties:
strategy:
type: string
enum:
- balanced
- cost
- latency
- quality
requested_models:
type: array
items:
type: string
minLength: 1
maxLength: 160
resolved_model:
type: string
minLength: 1
maxLength: 160
provider:
type:
- string
- 'null'
provider_attempts:
type: array
items:
$ref: '#/components/schemas/ProviderAttemptReceipt'
fallbacks_allowed:
type: boolean
data_policy:
type: string
enum:
- default
- no_training
- zero_retention
caching:
type: string
enum:
- auto
source:
type: string
enum:
- request
- project
- default
router:
$ref: '#/components/schemas/RouterDecisionSummary'
required:
- strategy
- requested_models
- resolved_model
- provider
- fallbacks_allowed
- data_policy
additionalProperties: false
ChatCompletionResponse:
type: object
properties:
cost:
type: object
properties:
this_request:
type: string
per_image:
type: string
per_video:
type: string
images:
type: integer
minimum: 0
required:
- this_request
additionalProperties: false
balance:
type: string
metadata:
type: object
properties:
latency_ms:
type: number
minimum: 0
group:
type: string
search_depth:
type: string
results_count:
type: integer
minimum: 0
required:
- latency_ms
additionalProperties: false
id:
type: string
object:
type: string
enum:
- chat.completion
created:
type: integer
model:
type: string
minLength: 1
maxLength: 160
resolved_model:
type: string
minLength: 1
maxLength: 160
provider:
type:
- string
- 'null'
choices:
type: array
items:
type: object
properties:
index:
type: integer
message:
type: object
properties:
role:
type: string
enum:
- assistant
content:
type:
- string
- 'null'
reasoning_content:
type: string
tool_calls:
type: array
items:
type: object
properties:
id:
type: string
minLength: 1
maxLength: 128
type:
type: string
enum:
- function
extra_content:
type: object
properties:
google:
type: object
properties:
thought_signature:
type: string
minLength: 1
required:
- thought_signature
additionalProperties: false
additionalProperties: false
function:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 64
arguments:
type: string
required:
- name
- arguments
additionalProperties: false
required:
- id
- type
- function
additionalProperties: false
required:
- role
- content
additionalProperties: false
finish_reason:
type:
- string
- 'null'
required:
- index
- message
- finish_reason
additionalProperties: false
usage:
$ref: '#/components/schemas/ChatUsage'
cost_usd:
type: number
minimum: 0
request_id:
type: string
routing:
$ref: '#/components/schemas/RoutingSummary'
required:
- id
- object
- created
- model
- resolved_model
- provider
- choices
- usage
- cost_usd
- request_id
- routing
additionalProperties: false
ChatUsage:
type: object
properties:
prompt_tokens:
type: integer
minimum: 0
completion_tokens:
type: integer
minimum: 0
total_tokens:
type: integer
minimum: 0
prompt_tokens_details:
type: object
properties:
cached_tokens:
type: integer
minimum: 0
cache_creation_tokens:
type: integer
minimum: 0
additionalProperties: false
completion_tokens_details:
type: object
properties:
reasoning_tokens:
type: integer
minimum: 0
additionalProperties: false
required:
- prompt_tokens
- completion_tokens
- total_tokens
additionalProperties: false
RouterDecisionSummary:
type: object
properties:
id:
type: string
enum:
- ninja/auto
task:
type: string
classified_by:
type: string
enum:
- regex
- llm
- llm-cached
override:
type:
- string
- 'null'
enum:
- long_context
- multilingual
reasoning:
type: string
candidates:
type: array
items:
type: string
minLength: 1
maxLength: 160
considered:
type: array
items:
type: object
properties: {}
required:
- id
- task
- classified_by
- override
- reasoning
- candidates
- considered
additionalProperties: false
PresetChatCompletionsRequest:
type: object
properties:
content_filter:
type: boolean
enum:
- true
description: Optional explicit acknowledgement of mandatory server-side content filtering. Only true is accepted. Filtering remains enforced when omitted; false is rejected.
model:
type: string
minLength: 1
maxLength: 160
models:
type: array
items:
type: string
minLength: 1
maxLength: 160
minItems: 1
maxItems: 15
messages:
type: array
items:
oneOf:
- type: object
properties:
role:
type: string
enum:
- developer
content:
anyOf:
- type: string
minLength: 1
- type: array
items:
type: object
properties:
type:
type: string
enum:
- text
text:
type: string
minLength: 1
required:
- type
- text
additionalProperties: false
minItems: 1
required:
- role
- content
additionalProperties: false
- type: object
properties:
role:
type: string
enum:
- system
content:
anyOf:
- type: string
minLength: 1
- type: array
items:
type: object
properties:
type:
type: string
enum:
- text
text:
type: string
minLength: 1
required:
- type
- text
additionalProperties: false
minItems: 1
required:
- role
- content
additionalProperties: false
- type: object
properties:
role:
type: string
enum:
- user
content:
anyOf:
- type: string
minLength: 1
- type: array
items:
anyOf:
- type: object
properties:
type:
type: string
enum:
- text
text:
type: string
minLength: 1
required:
- type
- text
additionalProperties: false
- type: object
properties:
type:
type: string
enum:
- image_url
image_url:
type: object
properties:
url:
type: string
minLength: 1
maxLength: 7000000
detail:
type: string
enum:
- auto
- low
- high
required:
- url
additionalProperties: false
required:
- type
- image_url
additionalProperties: false
- type: object
properties:
type:
type: string
enum:
- file
file:
type: object
properties:
filename:
type: string
minLength: 1
maxLength: 255
file_data:
type: string
minLength: 1
maxLength: 7000000
file_url:
type: string
maxLength: 4096
format: uri
media_type:
type: string
enum:
- application/pdf
- text/plain
- text/markdown
- text/csv
- application/json
additionalProperties: false
required:
- type
- file
additionalProperties: false
minItems: 1
required:
- role
- content
additionalProperties: false
- type: object
properties:
role:
type: string
enum:
- assistant
content:
anyOf:
- type: string
minLength: 1
- type: array
items:
type: object
properties:
type:
type: string
enum:
- text
text:
type: string
minLength: 1
required:
- type
- text
additionalProperties: false
minItems: 1
- type: 'null'
tool_calls:
type: array
items:
type: object
properties:
id:
type: string
minLength: 1
maxLength: 128
type:
type: string
enum:
- function
extra_content:
type: object
properties:
google:
type: object
properties:
thought_signature:
type: string
minLength: 1
required:
- thought_signature
additionalProperties: false
additionalProperties: false
function:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 64
arguments:
type: string
required:
- name
- arguments
additionalProperties: false
required:
- id
- type
- function
additionalProperties: false
required:
- role
additionalProperties: false
- type: object
properties:
role:
type: string
enum:
- tool
content:
anyOf:
- type: string
- type: array
items:
anyOf:
- type: object
properties:
type:
type: string
enum:
- text
text:
type: string
minLength: 1
required:
- type
- text
additionalProperties: false
- type: object
properties:
type:
type: string
enum:
- image_url
image_url:
type: object
properties:
url:
type: string
minLength: 1
maxLength: 7000000
detail:
type: string
enum:
- auto
- low
- high
required:
- url
additionalProperties: false
required:
- type
- image_url
additionalProperties: false
- type: object
properties:
type:
type: string
enum:
- file
file:
type: object
properties:
filename:
type: string
minLength: 1
maxLength: 255
file_data:
type: string
minLength: 1
maxLength: 7000000
file_url:
type: string
maxLength: 4096
format: uri
media_type:
type: string
enum:
- application/pdf
- text/plain
- text/markdown
- text/csv
- application/json
additionalProperties: false
required:
- type
- file
additionalProperties: false
minItems: 1
tool_call_id:
type: string
minLength: 1
maxLength: 128
required:
- role
- content
- tool_call_id
additionalProperties: false
minItems: 1
max_completion_tokens:
type: integer
exclusiveMinimum: 0
maximum: 9007199254740991
description: 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.
temperature:
type: number
minimum: 0
maximum: 2
top_p:
type: number
minimum: 0
maximum: 1
stop:
anyOf:
- type: string
- type: array
items:
type: string
minItems: 1
maxItems: 4
frequency_penalty:
type: number
minimum: -2
maximum: 2
presence_penalty:
type: number
minimum: -2
maximum: 2
seed:
type: integer
user:
type: string
maxLength: 256
stream:
type: boolean
default: false
stream_options:
type: object
properties:
include_usage:
type: boolean
additionalProperties: false
response_format:
oneOf:
- type: object
properties:
type:
type: string
enum:
- text
required:
- type
additionalProperties: false
- type: object
properties:
type:
type: string
enum:
- json_object
required:
- type
additionalProperties: false
- type: object
properties:
type:
type: string
enum:
- json_schema
json_schema:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 128
description:
type: string
schema:
type: object
additionalProperties: {}
strict:
type: boolean
default: true
required:
- name
- schema
additionalProperties: false
required:
- type
- json_schema
additionalProperties: false
tools:
type: array
items:
type: object
properties:
type:
type: string
enum:
- function
function:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 64
pattern: ^[a-zA-Z0-9_-]+$
description:
type: string
parameters:
type: object
additionalProperties: {}
default: {}
strict:
type: boolean
required:
- name
additionalProperties: false
required:
- type
- function
additionalProperties: false
tool_choice:
anyOf:
- type: string
enum:
- none
- auto
- required
- type: object
properties:
type:
type: string
enum:
- function
function:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 128
required:
- name
additionalProperties: false
required:
- type
- function
additionalProperties: false
parallel_tool_calls:
type: boolean
reasoning:
$ref: '#/components/schemas/ChatReasoning'
routing:
$ref: '#/components/schemas/RoutingPolicy'
required:
- messages
additionalProperties: false
securitySchemes:
managementKey:
type: http
scheme: bearer
bearerFormat: nj_mk_...
description: Account-scoped management credential created by the account owner after email verification. Inference keys cannot access these endpoints; management keys cannot run inference.
anthropicApiKey:
type: apiKey
in: header
name: x-api-key
description: NinjaChat API key accepted by the Anthropic Messages compatibility endpoint.
bearerAuth:
type: http
scheme: bearer
bearerFormat: NinjaChat API key
description: Use an API key created in the NinjaChat developer console.
x-ninjachat-contract-sha256: df530775ec7be5779917a6c4c5b6015b760809e62fd002827541bf6cac66310e