SCRIPT NINJA / DOCS

A small integration. A clear response.

Use your Script Ninja key from your application's server. Keep it out of public code and browser bundles.

The initial API supports text chat requests without streaming. Account and API activation are still being prepared.

Make a request.

POST https://scriptninja.pro/api/v1/chat/completions
Authorization: Bearer YOUR_SCRIPT_NINJA_KEY
Content-Type: application/json

{
  "model": "ninja-fast",
  "messages": [{"role": "user", "content": "Summarise this project brief."}],
  "max_tokens": 1024,
  "stream": false
}

Models and limits.

Use ninja-fast or ninja-pro. This release accepts system, user and assistant text messages, up to 30 messages and 60KB total message data. Maximum output is 8,192 tokens per request. An account can have up to three requests in progress.

Inspect your usage.

Successful responses contain prompt_tokens, completion_tokens, total_tokens and cached_input_tokens. Cached input is part of prompt_tokens, so do not add it again. The billing object includes charge_usd and request_id.

Credit reservations.

A request reserves enough credit for its bounded input and maximum output. Completed requests settle against the recorded usage. If a request is interrupted and its usage is unknown, the reservation stays pending for reconciliation.

Handle errors.

StatusMeaning
400Check the model, message format and output limit.
401The key is missing, invalid or revoked.
402Add enough credit for the request.
429Wait for current requests to finish.
502The request failed or needs reconciliation. Do not immediately replay a potentially billable request.
503The service is temporarily unavailable or not yet activated.

Rotate a key.

Create a new key in your dashboard, update your application's secret configuration, then revoke the old key. The raw key is displayed only when it is created.

Review token pricing ↗

LET'S MAKE SOMETHING USEFUL.

What is your
next move?

Start a project ↗