EnglishAPI PlatformOpenAI-compatible

Nulu API documentation

Integrate your applications with OpenAI-compatible endpoints using Nulu models.

This whole documentation as a single prompt. Paste it into your coding agent and it will know how to use Nulu API. View as text

Getting Started

Start
Base URL and core concepts.
Base URL
https://api.nuluai.com/v1
Auth
Bearer sk_wat_...
Model
nulu-5-ultra
Nulu Code (CLI)
The Nulu AI coding agent for your terminal. Install it step by step: eight short steps, about ten minutes, no coding knowledge needed.

What you need

  • A computer with Windows, macOS or Linux and an internet connection.
  • Node.js 18 or later. If you do not have it, step 3 installs it.
  • A Nulu AI account with balance: the same account as on this platform.

Step-by-step installation

Copy each command, paste it into the terminal and press Enter.

  1. 1. Open the terminal

    The terminal is the window where commands are typed. Windows: press the Windows key, type PowerShell and press Enter. macOS: press Cmd + Space, type Terminal and press Enter. Linux: press Ctrl + Alt + T.

  2. 2. Check whether you already have Node.js

    Paste this command and press Enter:

    node --version

    If it answers v18 or a higher number (for example v22.11.0), jump to step 4. If it answers with an error or a lower number, continue with step 3.

  3. 3. Install Node.js

    Node.js comes with npm, the program that installs Nulu Code. Use the command for your system; when it finishes, close the terminal and open it again. If you prefer an installer with windows, download the LTS version from nodejs.org.

    Windows (PowerShell)
    winget install OpenJS.NodeJS.LTS
    macOS and Linux (terminal)
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
    # close the terminal, open it again and paste:
    nvm install --lts
    Check: both must answer with a number
    node --version
    npm --version
  4. 4. Install Nulu Code

    Paste the first line; it takes about a minute. The second one checks that it is installed: it must answer with a version number.

    npm install -g nulu-code
    nulu --version

    Lines that start with “npm warn” or “npm notice” are notices, not errors. If the second line answers with a version number, the installation worked and you can continue.

  5. 5. Have your Nulu AI account ready

    It is the same account as on this platform. If you do not have one, sign up, confirm your email and add balance: Nulu Code works with that balance.

  6. 6. Open Nulu Code in your project folder

    Nulu Code works inside the folder where you open it. To start a new project, paste these three commands, one at a time:

    mkdir my-project
    cd my-project
    nulu

    Already have a project? Type cd followed by the path of its folder, then nulu.

  7. 7. Sign in

    The first time, Nulu Code shows a link. Open it in your browser, sign in to this platform and press Authorize. The page shows a one-time code that works for 10 minutes: copy it, paste it into the terminal and press Enter. You do not need to create or copy an API key. Do not share that code with anyone; Nulu AI will never ask you for it.

  8. 8. Ask for your first task

    Type what you want in your own words and press Enter. For example:

    Create a simple website for my business with a contact form

    Before changing files or running commands, Nulu Code asks for your permission. Read each action and accept it if you agree.

Done. Next time you only need to open the terminal, go to your project folder and type nulu. Usage is charged to your Nulu AI balance; there is no separate account or subscription. You can see and revoke connected terminals in the dashboard, under Connected devices.

All the commands

In the terminal
nulu              # opens Nulu Code in the current folder
nulu --continue   # continues your last conversation
nulu run "..."    # sends a single instruction and prints the answer
nulu login        # signs in or switches account
nulu logout       # signs out on this computer
nulu models       # models available in your account
nulu usage        # usage and estimated cost
nulu doctor       # checks everything and says what to fix
nulu update       # installs the latest version
nulu --version    # installed version
nulu --help       # help with every option
npm uninstall -g nulu-code   # uninstalls Nulu Code
Inside Nulu Code (typed in the message box; with the interface in Spanish they also have Spanish names)
/help          # lists every command and key
/models        # switches model
/new           # starts a new conversation
/resume        # goes back to an earlier conversation
/undo          # undoes your last message
/copy          # copies the last answer or the whole conversation
/usage         # balance, money spent and tokens used
/permissions   # approve each action, or let the agent work on its own
/language      # switches between Spanish and English
/update        # installs the latest version without leaving

If something fails

Find the message you got and follow the fix.

“node” or “npm” is not recognized as a command

Node.js is not installed, or the terminal was opened before installing it. Close the terminal, open it again and try this command. If it still fails, repeat step 3.

node --version
Windows: “winget” is not recognized as a command

Your Windows does not include winget. Download the Node.js installer (LTS version) from nodejs.org, install it with the default options and open PowerShell again.

Windows: “running scripts is disabled on this system”

PowerShell is blocking npm. Paste this command, answer Y (yes) and repeat the command that failed.

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
macOS or Linux: permission error (EACCES) while installing

It happens when Node.js was installed for the whole system. The best fix is to install Node.js as step 3 says and repeat step 4. The quick alternative is this command.

sudo npm install -g nulu-code
“nulu” is not recognized as a command after installing

Close the terminal and open it again. If nothing changes, install again and check that it does not end with an error.

npm install -g nulu-code
While installing you see “npm warn install-scripts … not yet covered by allowScripts”

It is a notice, not an error: recent npm versions do not run the last step of the installation and report it this way. Nulu Code finishes that step by itself the first time you open it. Paste the first line: if it answers with a version number, everything is fine and you can continue with step 5. Only if it answers “install script did not run” (it happens on Windows), install again with the second line.

nulu --version
npm install -g --allow-scripts=nulu-code nulu-code
While installing you see other “npm warn” or “npm notice” lines

They are notices from npm (for example, that a new npm version exists) and they do not stop the installation. A real error starts with “npm error”. Check that Nulu Code is installed with this command: it must answer with a version number.

nulu --version
nulu answers “install script did not run”

Your npm version blocked one step of the installation (npm 12 and later do so by default). Install with this command.

npm install -g --allow-scripts=nulu-code nulu-code
The Node.js version is lower than 18

Install the current version: on macOS and Linux with the first line, on Windows with the second.

nvm install --lts
winget install OpenJS.NodeJS.LTS
The sign-in code is refused or expired

The code works for 10 minutes and only once. Ask for a new one and paste it into the same terminal that showed the link.

nulu login
The sign-in link does not open by itself

Select the whole link in the terminal, copy it and paste it into your browser's address bar.

It says you have no balance

Add balance in this platform's dashboard and try again. Inside Nulu Code, /usage shows your balance.

Something else does not work

The first line checks everything and tells you what to fix. To start from scratch, uninstall with the second one and repeat step 4. If you write to support, include your operating system and what nulu --version answers; never send your sign-in code or your API key.

nulu doctor
npm uninstall -g nulu-code

More about Nulu Code

Authentication
Every request requires a Nulu API key.
Authorization: Bearer sk_wat_your_key
Create keys in the `API Key` dashboard section. Full secrets are shown once and then stored hashed.
  • The same key works on every endpoint: models, tools, files and usage.
  • The /v1/messages endpoint also accepts the key in the x-api-key header.
  • Keep it in a server environment variable (for example NULU_API_KEY). Do not put it in browser or mobile application code.
  • Without a valid key the API answers 401 (invalid_api_key); with a balance below $0.50, 402 (insufficient_credit).
Quickstart
Your first request in under a minute.
  1. Create a key in the dashboard, API Key section, and add balance (minimum $0.50).
  2. Send the request. With an OpenAI-compatible SDK you only change base_url and the key.
  3. Read the text in choices[0].message.content and the consumption in usage.
curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "messages": [
      {"role": "system", "content": "Answer in one short sentence."},
      {"role": "user", "content": "What is a managed AI API?"}
    ],
    "max_tokens": 100
  }'
Response
{
  "id": "6bf293db-ee07-41d7-98e1-2c5889e05750",
  "object": "chat.completion",
  "created": 1796335244,
  "model": "nulu-5-ultra",
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "A managed AI API is a hosted service that ..."},
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 243,
    "completion_tokens": 34,
    "total_tokens": 277,
    "prompt_tokens_details": {"cached_tokens": 128}
  }
}
The model field must be a Nulu model id, lowercase and exact. Do not keep the key in your code: read it from an environment variable (for example NULU_API_KEY).
Supported models
Public models available and what each one supports.
curl https://api.nuluai.com/v1/models \
  -H "Authorization: Bearer sk_wat_your_key"
Copy IDs exactly as shown here.
Public IDNameCapabilitiesThinking
nulu-5-proNulu 5 ProChat, Reasoning, Function callingOptional
nulu-5-ultraNulu 5 UltraChat, Vision, Reasoning, Function calling, Web search, Deep thinking search, URL reading, File input, Content safety, Conversation titlesOptional
nulu-image-1.5Nulu Image 1.5 (Legacy)Image generation and editingUnavailable
nulu-image-3Nulu Image 3Image generation and editingUnavailable
API protocols
Three protocols over the same models: Chat Completions, Responses and Messages.

Nulu API speaks three protocols. Pick the one your code or SDK already uses: all three support streaming, functions, files, vision, web tools, content safety and titles, and are billed the same way.

ProtocolEndpointModelsNotes
Chat CompletionsPOST /v1/chat/completionsAll chat modelsOpenAI Chat Completions compatible format.
ResponsesPOST /v1/responsesnulu-5-ultra, nulu-5-proOpenAI Responses compatible format. Stateless: previous_response_id, conversation and background return 400.
MessagesPOST /v1/messagesnulu-5-ultra, nulu-5-proMessages format. max_tokens is required. Accepts x-api-key as well as Authorization.

Base URLs and SDK setup

ProtocolSDK base URLDetail
Chat Completions, Responseshttps://api.nuluai.com/v1Includes /v1.
Messageshttps://api.nuluai.comWithout /v1: the Messages SDK appends /v1/messages by itself.
Plain HTTPhttps://api.nuluai.com/v1For cURL, requests or fetch.
Install the SDKs
# Python
pip install openai anthropic requests

# JavaScript / TypeScript (Node.js 18+)
npm install openai @anthropic-ai/sdk
Chat Completions
curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "messages": [
      {"role": "system", "content": "Answer in one short sentence."},
      {"role": "user", "content": "What is a managed AI API?"}
    ],
    "max_tokens": 100
  }'
Responses
curl https://api.nuluai.com/v1/responses \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "input": "Say hello in five words.",
    "max_output_tokens": 100
  }'
Messages
curl https://api.nuluai.com/v1/messages \
  -H "x-api-key: sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 100,
    "messages": [{"role": "user", "content": "Say hello in five words."}]
  }'
Public model ids are lowercase and exact. Use nulu-5-pro, nulu-5-ultra, nulu-image-1.5, nulu-image-3 in any SDK, in opencode and in external applications.

Compatibility matrix

CapabilityChat CompletionsResponsesMessages
Text, streaming, function calling, JSON output, visionYesYesYes
Thinkingthinking / reasoning_effortreasoning.effortthinking
Web search, deep thinking search, image searchYesYesYes
URL readingYesYesYes
File referencesfile partinput_filedocument block
Citationsmessage.annotationsoutput_text.annotationscitations on text blocks
Tool activity while streamingserver_tool_eventresponse.web_search_call.*content blocks
Content safety, conversation titleYesYesYes
User context markerYesNoYes
Stored conversations (previous_response_id)n/aNon/a
  • Web tools: nulu-5-ultra only. Files: nulu-5-ultra and nulu-5-pro (the latter, text only).
  • The standalone APIs (search, fetch, OCR, speech, files) are REST and do not depend on the protocol.
  • Other endpoints: GET /v1/models, POST /v1/images/generations, POST /v1/images/edits. The full list is in API Reference.

Model Capabilities

Thinking mode
The model reasons step by step before answering. Enabled per request.

Thinking is off by default on all three protocols, so you decide when to pay for it. Turn it on for the questions that need it: maths, planning, debugging, analysis.

ProtocolHow to enableWhere the reasoning arrives
Chat Completionsreasoning_effort: low, medium, high or max (turns it on by itself), or thinking: {"type": "enabled"}message.reasoning_content
Responsesreasoning: {"effort": "low" | "high" | "max"}reasoning item in output
Messagesthinking: {"type": "enabled"}thinking blocks in content
Chat Completions
curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "messages": [{"role": "user", "content": "What is 17 * 23? Answer with the number."}],
    "reasoning_effort": "high",
    "max_tokens": 600
  }'
Response (abridged)
{
  "choices": [{
    "index": 0,
    "finish_reason": "stop",
    "message": {
      "role": "assistant",
      "content": "391",
      "reasoning_content": "17 * 23 = 17 * 20 + 17 * 3 = 340 + 51 = 391."
    }
  }],
  "usage": {
    "prompt_tokens": 267,
    "completion_tokens": 17,
    "total_tokens": 284,
    "prompt_tokens_details": {"cached_tokens": 128},
    "completion_tokens_details": {"reasoning_tokens": 15}
  }
}
Other protocols and explicit off
from openai import OpenAI

client = OpenAI(api_key="sk_wat_your_key", base_url="https://api.nuluai.com/v1")

response = client.responses.create(
    model="nulu-5-ultra",
    input="What is 17 * 23? Answer with the number.",
    reasoning={"effort": "high"},  # "low" | "high" | "max"
    max_output_tokens=600,
)
print(response.output_text)
print("reasoning tokens:", response.usage.output_tokens_details.reasoning_tokens)
Pricing: thinking uses the model's normal per-token rates, with no multiplier. It costs more because reasoning tokens are billed as output tokens; usage.completion_tokens_details.reasoning_tokens reports how many there were.
  • max_tokens includes the reasoning: if it is low, the answer can come back empty with finish_reason: "length".
  • With functions: when a thinking-mode assistant turn carries tool_calls, send it back with its reasoning_content intact on later turns.
  • With web_search declared, turning thinking on makes the search a deep thinking search.
  • In the Python SDK the Nulu AI specific fields (thinking, title, safety_check) go in extra_body; in JavaScript they are sent next to the other parameters.
Vision
Send images in the message and the model answers about what it sees.

Add an image_url part to the content of the user message. The URL can be a public https:// address or a base64 image (data:image/jpeg;base64,…). You can send several images and combine them with text.

At a glance
Modelsnulu-5-ultra
ProtocolsChat Completions (image_url), Responses (input_image), Messages (image block)
AuthenticationAuthorization: Bearer <key> (Messages also accepts x-api-key)
FormatsJPEG, PNG, GIF, WebP
StreamingYes
Rate limit120 model requests per minute per key; above it, 429 with a retry-after header
Billing unitModel input tokens

Examples

IMAGE=$(base64 < photo.jpg | tr -d '\n')

curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 100,
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "Describe this image in one sentence."},
        {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,'"$IMAGE"'"}}
      ]
    }]
  }'

The response is a normal chat response: the text is in choices[0].message.content and the image tokens are in usage.prompt_tokens.

Pricing

  • No per-image fee: each image counts as input tokens ($0.45 per 1M on Nulu 5 Ultra; double during peak hours). Larger images use more tokens.
  • Example: a small photo (640×420) with a short question used about 430 input tokens and 20 output tokens: 430 × $0.45 / 1M + 20 × $1.80 / 1M = $0.0002295.
  • A rejected request (4xx) is not charged.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • The cost is in the tokens: usage.prompt_tokens (input) and usage.completion_tokens (output) of the same response.
  • GET /v1/account/usage returns every request with its tokens and charge_usd; the dashboard Usage page shows the same.

Known limitations

  • Still images only: no video or audio.
  • An https:// URL must be public and reachable without a sign-in; otherwise send the image as base64.
  • The API stores no conversations: the image is sent again (and billed as input) on every turn of the history. For many questions about the same file, upload it and reference it by id.
  • To get the exact text of a document use OCR; vision describes and interprets, it does not guarantee a literal transcription.

Common errors and troubleshooting

Error or symptomWhat to do
The model says it sees no imageCheck that you use nulu-5-ultra and that the part is {"type": "image_url", "image_url": {"url": "…"}}.
400 with a base64 imageThe prefix must match the real format (data:image/png;base64, for PNG) and the base64 must have no line breaks.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Describing product photos or generating alt text.
  • Reading charts, diagrams and screenshots.
  • Reviewing a user interface or a photographed document.
Function calling
The model asks to run functions you define; your application runs them.

Describe your functions in tools. When the model needs one it answers with tool_calls and finish_reason: "tool_calls" instead of text. Your application runs the function, appends a role: "tool" message with the tool_call_id and the result, and calls the model again.

curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 200,
    "messages": [{"role": "user", "content": "What is the weather in Caracas?"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the current weather for a city",
        "parameters": {
          "type": "object",
          "properties": {"city": {"type": "string"}},
          "required": ["city"]
        }
      }
    }]
  }'
First response: the model asks for the function
{
  "choices": [{
    "index": 0,
    "finish_reason": "tool_calls",
    "message": {
      "role": "assistant",
      "content": "",
      "tool_calls": [{
        "index": 0,
        "id": "call_00_WwynB9N3OjlttSeFPXWU7026",
        "type": "function",
        "function": {"name": "get_weather", "arguments": "{\"city\": \"Caracas\"}"}
      }]
    }
  }],
  "usage": {"prompt_tokens": 497, "completion_tokens": 39, "total_tokens": 536}
}
  • Available on nulu-5-ultra and nulu-5-pro, on all three protocols (each with its own tool format).
  • The model never runs your functions: it only returns the name and the arguments as JSON. Validate the arguments before using them.
  • Send the assistant turn back unchanged (with its tool_calls and, if thinking was on, its reasoning_content).
  • Your functions can live next to the server tools (web_search, read_url) in the same request.
  • Pricing: the function definitions and their results count as input tokens; there is no per-call charge.
Structured outputs (JSON)
Answers as valid JSON, ready to parse.

Send response_format: {"type": "json_object"}, include the word JSON in the prompt and show the shape you expect. The answer is a JSON object in message.content.

curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 200,
    "response_format": {"type": "json_object"},
    "messages": [
      {"role": "system", "content": "Reply with JSON only, shaped like {\"city\": string, \"country\": string}."},
      {"role": "user", "content": "Where is the Eiffel Tower?"}
    ]
  }'
  • JSON mode guarantees valid JSON, not a schema: validate the fields in your code.
  • Set max_tokens with headroom: if the answer is cut (finish_reason: "length"), the JSON is incomplete.
  • To extract data from a document, combine it with File input.
File input
Reference an uploaded file inside a message so the model reads it.

Upload the file once to /v1/files and put its id in the user message. The model receives its content together with your question. The shape of the reference depends on the protocol.

At a glance
Modelsnulu-5-ultra (text, figures and images) and nulu-5-pro (text only)
Chat Completions{"type": "file", "file_id": "file-api-…"}
Responses{"type": "input_file", "file_id": "file-api-…"}
Messages{"type": "document", "source": {"type": "file", "file_id": "file-api-…"}}
AuthenticationAuthorization: Bearer <key> (Messages also accepts x-api-key)
StreamingYes
Rate limit120 model requests per minute per key; above it, 429 with a retry-after header
Billing unitModel input tokens

Examples

Chat Completions
curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 100,
    "messages": [{
      "role": "user",
      "content": [
        {"type": "file", "file_id": "file-api-1234"},
        {"type": "text", "text": "What is the total due? Answer with the amount only."}
      ]
    }]
  }'
Other protocols
from openai import OpenAI

client = OpenAI(api_key="sk_wat_your_key", base_url="https://api.nuluai.com/v1")

response = client.responses.create(
    model="nulu-5-ultra",
    max_output_tokens=100,
    input=[{
        "role": "user",
        "content": [
            {"type": "input_file", "file_id": "file-api-1234"},
            {"type": "input_text", "text": "What is the total due? Answer with the amount only."},
        ],
    }],
)
print(response.output_text)

The response is a normal model response; usage.prompt_tokens includes the tokens of the file.

Pricing

  • No per-reference fee: the content of the file counts as input tokens on every request ($0.45 per 1M on Nulu 5 Ultra, $0.009 when cached; double during peak hours).
  • Example: three questions about a 20,000-token document, 200 output tokens each: 3 × (20,000 × $0.45 / 1M + 200 × $1.80 / 1M = $0.00936). With context caching the second and third usually cost less.
  • Parsing the document is charged separately and once, at upload ($0.675 per 1,000 pages).
  • A rejected request (for example, 404 file_not_found) is not charged.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • The cost is in the tokens: usage.prompt_tokens (input) and usage.completion_tokens (output) of the same response.
  • GET /v1/account/usage returns every request with its tokens and charge_usd; the dashboard Usage page shows the same.

Known limitations

  • Up to 20 documents per request.
  • The API stores no conversations: send the file reference again in the history of every request.
  • Put files at the start of the conversation and keep their order: that way the prefix is reused from the cache.
  • An expired or deleted file stops working even if it is still in your history.

Common errors and troubleshooting

Error or symptomWhat to do
404 file_not_foundThe id does not exist, expired or belongs to another account. Upload the file again and update the history.
The model ignores the figuresUpload the file with rich_layout_recognition and use nulu-5-ultra.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Questions and answers over contracts, manuals or reports.
  • Extracting fields from a document into JSON (combine it with JSON output).
  • Comparing several documents in a single request.
Context caching
Repeated prefixes are billed at a lower rate, automatically.

There is nothing to enable. When a request starts the same way as an earlier one (same system prompt, same documents, same history), that part is served from the cache and billed at the cached-input rate.

On Nulu 5 Ultra input costs $0.45 per 1M tokens and cached input $0.009. usage.prompt_tokens_details.cached_tokens reports how many tokens of the request came from the cache.

from openai import OpenAI

client = OpenAI(api_key="sk_wat_your_key", base_url="https://api.nuluai.com/v1")

manual = "Nulu AI support manual. " + "Refunds are processed within five business days. " * 400

for question in ["How long do refunds take?", "Who processes refunds?"]:
    response = client.chat.completions.create(
        model="nulu-5-ultra",
        max_tokens=60,
        messages=[
            {"role": "system", "content": manual},  # stable prefix first
            {"role": "user", "content": question},  # changing part last
        ],
    )
    usage = response.usage
    print(usage.prompt_tokens, "input tokens,", usage.prompt_tokens_details.cached_tokens, "from cache")
  • Put what does not change first (instructions, documents) and what changes last (the question).
  • The cache matches on the exact prefix: a change at the start of the prompt invalidates everything after it.
  • Caching is a likely saving, not a guaranteed one: the first request, and requests that come much later, pay the normal rate.
  • On Messages the usage arrives as cache_read_input_tokens; on Responses, as input_tokens_details.cached_tokens.

Web and Research Tools

URL reading
The model opens the links in the user message and answers from their content.

Declare {"type": "read_url"} in tools. The links in the last user message are opened on the server (the first 10 distinct ones) and the model answers from what it read. Each read appears in server_tool_calls with kind: "read_link".

If a page cannot be opened, the call arrives with status: "failed" and an error.code; the model is told and does not claim to have read it.

At a glance
Modelsnulu-5-ultra only
ProtocolsChat Completions, Responses, Messages
AuthenticationAuthorization: Bearer <key> (Messages also accepts x-api-key)
StreamingYes (server_tool_event with read_link)
Rate limit120 model requests per minute per key; above it, 429 with a retry-after header
Billing unitModel tokens (no separate charge)

Examples

curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 200,
    "tools": [{"type": "read_url"}],
    "messages": [{"role": "user", "content": "Summarize https://nodejs.org/en/about/previous-releases in two sentences."}]
  }'
Calls in the response
"server_tool_calls": [{
  "index": 0,
  "calls": [{
    "index": 0,
    "id": "srvtoolu_rl_00_1b23c606...",
    "type": "read_url",
    "kind": "read_link",
    "action": {"type": "read_link", "url": "https://nodejs.org/en/about/previous-releases"},
    "status": "completed",
    "page": {"url": "https://nodejs.org/en/about/previous-releases", "title": "Node.js Releases", "published_at": null},
    "signature": "lSMvOnQcTf+yVKPchzWf..."
  }]
}]

// A page that could not be read:
{"status": "failed", "action": {"type": "read_link", "url": "..."}, "error": {"code": "url_not_accessible"}}

Pricing

  • No per-page fee: the content read counts as model input tokens (input $0.45 per 1M on Nulu 5 Ultra; double during peak hours).
  • Example: summarising a 6,000-token page with 150 output tokens costs 6,000 × $0.45 / 1M + 150 × $1.80 / 1M = $0.00297 off-peak.
  • A failed read adds no page content: you pay only the tokens of the rest of the conversation.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • usage.server_tool_use counts the operations of the request (tool_fetch). It is informational: nothing is charged separately.
  • The cost is in the tokens: usage.prompt_tokens (input) and usage.completion_tokens (output) of the same response.
  • GET /v1/account/usage returns every request with its tokens and charge_usd; the dashboard Usage page shows the same.

Known limitations

  • Only links in the last user message are opened, and at most the first 10 distinct ones.
  • The page text is not returned to the client. If you need the text, use the Fetch API (/v1/tools/fetch).
  • Pages behind a sign-in or paywall, and private or internal addresses, cannot be read.
  • On later turns send the assistant turn back unchanged: the page is restored from its signature, without downloading it again.
  • With thinking and web_search declared together, links are handled by deep thinking search.

Common errors and troubleshooting

Error or symptomWhat to do
error.code: url_not_accessibleThe page does not respond, requires a sign-in or has no readable text. Check the URL in a signed-out browser.
error.code: url_not_allowedPrivate, internal or blocked address. Only public web addresses are read.
error.code: unavailableTemporary reader failure. Retry later.
400 unsupported_toolWeb tools work on nulu-5-ultra only. Change the model.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • "Summarise this article" or "what does this page say about X?" in a chat.
  • Comparing the content of several links the user pastes.
  • Extracting data from a public page into JSON.
Search API
Web search results as JSON, without a model call.

POST /v1/tools/search returns ranked results with title, URL, snippet and summary. Use it when you want to control the search yourself: your own RAG pipeline, a search box, or your own function tools.

At a glance
EndpointPOST /v1/tools/search (JSON)
ModelsNo model involved
ProtocolsREST only
AuthenticationAuthorization: Bearer <key>
Rate limit120 requests per minute per key; above it, 429 with a retry-after header
Billing unitSuccessful request with results

Examples

FieldTypeDescription
querystring, required1–128 characters. Operators: site:, -site:, "exact phrase", lang:, after:, before:.
countinteger1–50 results; default 10.
need_contentbooleanIf true, each result includes the page text in content.
ori_questionstringOptional: the user's original question, to improve the ranking of results.
curl -i https://api.nuluai.com/v1/tools/search \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{"query": "python release schedule site:python.org", "count": 3}'
Response (abridged)
HTTP/1.1 200 OK
x-nulu-billed-units: 1 request
x-nulu-charge-cents: 0.225
x-request-id: 2dcd9c5c-62fe-4778-b9a3-0cc454a51be3

{
  "object": "search.result",
  "query": "python release schedule site:python.org",
  "results": [{
    "title": "Status of Python versions",
    "url": "https://devguide.python.org/versions/",
    "snippet": "...",
    "summary": "...",
    "content": null,
    "site_name": "Python Developer's Guide",
    "site_icon": null,
    "date": "2026-05-26T16:00:00+00:00",
    "authority": 4,
    "rerank_score": 2.52
  }]
}

Pricing

  • $2.25 per 1,000 successful requests. Billed per request, not per result: asking for 3 or 50 results costs the same.
  • Example: 400 searches in a day cost 400 × $2.25 / 1,000 = $0.90. One search costs $0.00225.
  • Not charged: a search with no results, a 4xx or 5xx error. There are no model tokens: this API calls no model.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • Every successful response carries x-nulu-charge-cents (what was charged, in US cents) and x-nulu-billed-units (the units billed).
  • GET /v1/account/usage lists every operation and groups it under nulu-search in summary.by_model.
  • In the dashboard, the Usage page shows the same operations with their cost.

Known limitations

  • The query is limited to 128 characters.
  • Unknown fields are rejected with 400 unsupported_parameter: there is no pagination and no filters beyond the operators.
  • date, site_icon, content and summary can be null depending on the source.
  • Web results only: no image or video results.

Common errors and troubleshooting

Error or symptomWhat to do
400 unsupported_parameterYou sent a field that does not exist. Use only the ones in the table.
Empty resultsThe query is too narrow (for example, several site:). It is not charged; widen the query.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Retrieval for RAG with your own prompt and model.
  • A search box inside your product.
  • Monitoring mentions or news of a domain with site: and after:.
Fetch API
Turns a public web page into clean Markdown, without a model call.

POST /v1/tools/fetch downloads a public URL and returns its title and main content as Markdown, without menus or ads. The result is ready to index, summarise or pass to a model as context.

At a glance
EndpointPOST /v1/tools/fetch (JSON: {"url": "https://..."})
ModelsNo model involved
ProtocolsREST only
AuthenticationAuthorization: Bearer <key>
Rate limit60 requests per minute per key; above it, 429 with a retry-after header
Billing unitSuccessful request with content

Examples

curl -i https://api.nuluai.com/v1/tools/fetch \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'
Response (abridged)
HTTP/1.1 200 OK
x-nulu-billed-units: 1 request
x-nulu-charge-cents: 0.225

{
  "object": "fetch.result",
  "url": "https://example.com",
  "title": "Example Domain",
  "content": "This domain is for use in documentation examples ..."
}

Pricing

  • $2.25 per 1,000 successful requests. One request reads one URL.
  • Example: reading 250 pages costs 250 × $2.25 / 1,000 = $0.5625.
  • A failed fetch (400, 403, 404 or 5xx) is not charged. There are no model tokens; if you later pass the Markdown to a model, that request is billed by its tokens.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • Every successful response carries x-nulu-charge-cents (what was charged, in US cents) and x-nulu-billed-units (the units billed).
  • GET /v1/account/usage lists every operation and groups it under nulu-fetch in summary.by_model.
  • In the dashboard, the Usage page shows the same operations with their cost.

Known limitations

  • One URL per request.
  • Public web addresses only: private, internal or blocked ones return 403.
  • Pages that need a sign-in, or without readable text, return 404 url_not_accessible.
  • It returns the main content as Markdown, not the original HTML or the images.

Common errors and troubleshooting

Error or symptomWhat to do
400 invalid_urlThe URL is malformed. Include https://.
403 url_not_allowedPrivate, internal or blocked address. Do not retry.
404 url_not_accessibleThe page is unreachable, needs a sign-in or has no readable content. Check it in a signed-out browser.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Filling a knowledge base from public pages.
  • Reading the full text of Search API results.
  • Implementing your own "open link" function for an agent.

Document Intelligence

File upload
Upload a file once and use it by id in your requests.

POST /v1/files stores a file in your account and returns an id (file-api-…). That id is then referenced in any conversation. Files are private to your account: another account using the id gets a 404.

The purpose field decides what happens to the file: user_data stores it as is (images, plain text, spreadsheets, ebooks); text_recognition and rich_layout_recognition also parse it during the upload (see Document parsing).

At a glance
EndpointPOST /v1/files (multipart) · GET /v1/files · GET /v1/files/{id} · DELETE /v1/files/{id}
ModelsNo model involved
ProtocolsREST only; the id is then used on all three protocols
AuthenticationAuthorization: Bearer <key>
Rate limit20 uploads per minute per key; above it, 429 with a retry-after header
Retention30 days by default and at most; expires_after[seconds] from 3,600 to 2,592,000
Storage500 files and 2 GB per account; 64 MB per file

Examples

Form fieldDescription
fileRequired. The file.
purposeuser_data (default), text_recognition or rich_layout_recognition.
expires_after[anchor], expires_after[seconds]Optional. anchor must be created_at; seconds between 3600 and 2592000.
Upload, list, read and delete
curl https://api.nuluai.com/v1/files \
  -H "Authorization: Bearer sk_wat_your_key" \
  -F "purpose=user_data" \
  -F "expires_after[anchor]=created_at" \
  -F "expires_after[seconds]=86400" \
  -F "[email protected]"
cURL
# List (newest first), read one, delete one
curl "https://api.nuluai.com/v1/files?limit=5&order=desc" -H "Authorization: Bearer sk_wat_your_key"
curl https://api.nuluai.com/v1/files/file-api-1234 -H "Authorization: Bearer sk_wat_your_key"
curl -X DELETE https://api.nuluai.com/v1/files/file-api-1234 -H "Authorization: Bearer sk_wat_your_key"
Responses
{
  "id": "file-api-379dc6b7-d138-4e4f-b92f-ee6a8dff44d2",
  "object": "file",
  "bytes": 11892,
  "created_at": 1796335334,
  "filename": "photo.jpg",
  "purpose": "user_data",
  "expires_at": 1796421734
}

// GET /v1/files
{"object": "list", "data": [ ...files ], "first_id": "file-api-...", "last_id": "file-api-...", "has_more": false}

// DELETE /v1/files/{id}
{"id": "file-api-379dc6b7-d138-4e4f-b92f-ee6a8dff44d2", "object": "file", "deleted": true}

GET /v1/files accepts limit, after (id to continue from), order (asc or desc) and purpose.

Pricing

  • Uploading, storing, listing and deleting user_data files is free.
  • Files uploaded with text_recognition or rich_layout_recognition pay for parsing once, at upload: $0.675 per 1,000 pages.
  • When a file is referenced in a conversation, its content counts as model input tokens on every request.
  • A rejected upload is not charged.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • The upload response carries x-nulu-charge-cents (0 for user_data).
  • GET /v1/files shows what you have stored, with bytes and expires_at per file.

Known limitations

  • There are no permanent files: all expire after 30 days at most. Upload them again if you need them longer.
  • Neither the original nor the parsed text can be downloaded: keep your own copy.
  • The upload must send Content-Length: send a file or a buffer, not a stream without a length (a stream returns 411).
  • user_data accepts images (JPEG, PNG, GIF, WebP), plain text, spreadsheets (XLSX, XLS) and ebooks (EPUB, MOBI).

Common errors and troubleshooting

Error or symptomWhat to do
404 file_not_foundThe id does not exist, expired, was deleted or belongs to another account.
409 storage_limitYou reached 500 files or 2 GB. Delete files with DELETE /v1/files/{id}.
411The upload arrived without Content-Length. Send the file from a buffer or a file on disk.
400 "purpose must be one of…"Only user_data, text_recognition and rich_layout_recognition are accepted.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Chat attachments: the user uploads a file and asks about it several times.
  • Reusing the same document across many requests without sending it again.
  • Temporary files with a short expiry (expires_after).
Document parsing
Upload a PDF, an office document or a scan; it is parsed once and is ready for conversations.

Upload the document to /v1/files with purpose=text_recognition (text only) or purpose=rich_layout_recognition (text and figures). Parsing happens during the upload and can take up to about 2 minutes. The response includes pages, the number of pages parsed and billed.

Then reference the id in the conversation: the model receives the parsed content. With rich_layout_recognition the figures are given to the model as images.

At a glance
EndpointPOST /v1/files (multipart)
ModelsFor conversations: nulu-5-ultra and nulu-5-pro (the latter, text only)
ProtocolsUpload over REST; reference on all three protocols
AuthenticationAuthorization: Bearer <key>
Rate limit20 uploads per minute per key; above it, 429 with a retry-after header
FormatsPDF, DOC, DOCX, PPT, PPTX, PNG, JPEG, WebP, GIF, BMP, TIFF
Maximum size64 MB and 1,000 pages per file
Billing unitPage parsed, once

Examples

curl -i https://api.nuluai.com/v1/files \
  -H "Authorization: Bearer sk_wat_your_key" \
  -F "purpose=text_recognition" \
  -F "[email protected]"
Upload response
HTTP/1.1 200 OK
x-nulu-charge-cents: 0.0675
x-request-id: fc41e814-4c8d-4718-9fa3-ca729d9cbd9e

{
  "id": "file-api-947e1f21-0bb2-4ca6-b556-bf5e69fc4333",
  "object": "file",
  "bytes": 633,
  "created_at": 1796335343,
  "filename": "invoice.pdf",
  "purpose": "text_recognition",
  "pages": 1,
  "expires_at": 1798927343
}

How to reference the file on each protocol is in File input.

Pricing

  • $0.675 per 1,000 pages, charged once at upload. Referencing the file later does not charge parsing again.
  • Example: a 35-page PDF costs 35 × $0.675 / 1,000 = $0.0236 to upload.
  • Model tokens: every request that references the file pays its text as input tokens ($0.45 per 1M on Nulu 5 Ultra; $0.009 when cached). A 20,000-token document with 200 output tokens: 20,000 × $0.45 / 1M + 200 × $1.80 / 1M = $0.00936.
  • If parsing fails (unsupported format, damaged file), the upload is rejected and not charged.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • The upload response carries x-nulu-charge-cents and the pages field.
  • GET /v1/account/usage groups parsing under nulu-document-parsing; the dashboard Usage page shows the same.
  • Consumption in conversations appears as the input tokens of each request (usage.prompt_tokens).

Known limitations

  • At most 64 MB and 1,000 pages per file; up to 20 documents per request.
  • The parsed text cannot be downloaded. If you need the text in your own system, use the OCR API.
  • The upload is synchronous: wait for the response (up to ~2 min) and use a generous client timeout.
  • nulu-5-pro receives the text only; the figures of rich_layout_recognition need nulu-5-ultra.
  • Files expire after 30 days at most.

Common errors and troubleshooting

Error or symptomWhat to do
400 "the file format is not supported"The file is not a recognisable format (PDF, DOC, DOCX, PPT, PPTX, PNG, JPEG, WebP, GIF, BMP, TIFF) or is damaged. For plain text use purpose=user_data.
404 file_not_foundThe referenced id does not exist, expired or belongs to another account. Upload the document again.
Client timeout during the uploadParsing long documents takes time. Use a timeout of 3 minutes or more.
409 storage_limitDelete files you no longer use.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • "Chat with your PDF": contracts, manuals, reports.
  • Questions about slide decks or office documents without converting them yourself.
  • Analysing scanned documents together with their charts (rich_layout_recognition).
OCR
Extracts the text of images and documents and returns it in the response, without a model call.

POST /v1/tools/ocr takes a file and returns the recognised text page by page. It stores no file and calls no model: you get the text and decide what to do with it.

purpose=text_recognition returns text only. purpose=rich_layout_recognition keeps the page layout; that text may include position tokens.

At a glance
EndpointPOST /v1/tools/ocr (multipart: purpose, file)
ModelsNo model involved
ProtocolsREST only
AuthenticationAuthorization: Bearer <key>
Rate limit20 requests per minute per key; above it, 429 with a retry-after header
FormatsPDF, DOC, DOCX, PPT, PPTX, PNG, JPEG, WebP, GIF, BMP, TIFF
Maximum size64 MB and 1,000 pages per file
Billing unitPage recognised

Examples

curl -i https://api.nuluai.com/v1/tools/ocr \
  -H "Authorization: Bearer sk_wat_your_key" \
  -F "purpose=text_recognition" \
  -F "[email protected]"
Response
HTTP/1.1 200 OK
x-nulu-billed-units: 1 page
x-nulu-charge-cents: 0.0675

{
  "id": "ocr-4fb7ad9b-ff4f-4904-868e-2494bf099964",
  "object": "ocr.result",
  "created": 1796335351,
  "purpose": "text_recognition",
  "page_count": 1,
  "pages": [{
    "index": 0,
    "text": "RECEIPT No. 20418\n\nCoffee beans 1 kg 18.50\n\nPaper filters x100 4.25\n\nTOTAL 22.75 USD",
    "finish_reason": "stop"
  }]
}

Pricing

  • $0.675 per 1,000 pages. An image counts as one page.
  • Example: a 120-page scanned PDF costs 120 × $0.675 / 1,000 = $0.081.
  • A failed recognition is not charged. There are no model tokens: this API calls no model.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • Every successful response carries x-nulu-charge-cents (what was charged, in US cents) and x-nulu-billed-units (the units billed).
  • GET /v1/account/usage lists every operation and groups it under nulu-ocr in summary.by_model.
  • In the dashboard, the Usage page shows the same operations with their cost.

Known limitations

  • At most 64 MB and 1,000 pages per file.
  • The request is synchronous: long documents can take a couple of minutes.
  • Layout text (rich_layout_recognition) may carry position tokens you may want to filter out.
  • It returns no per-word coordinates or confidence scores. A finish_reason other than stop marks an incomplete page.

Common errors and troubleshooting

Error or symptomWhat to do
400 "the file format is not supported"The file is not a recognisable format (PDF, DOC, DOCX, PPT, PPTX, PNG, JPEG, WebP, GIF, BMP, TIFF) or is damaged. For plain text use purpose=user_data.
400 "purpose must be…"purpose is required here: text_recognition or rich_layout_recognition.
Empty or garbled textThe image is low resolution or rotated. Send a sharper, upright image.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Digitising invoices, receipts and forms into your database.
  • Indexing scanned documents in your own search engine.
  • Preparing text for your own pipeline, with any model.
Vision, OCR or document parsing
Three ways to work with images and documents: which one to use.
Native visionOCRDocument parsing
What it doesThe model sees the image and answers about it.Returns the recognised text. No model.Parses the document once; you then reference it by id in conversations.
Howimage_url part in the messagePOST /v1/tools/ocrPOST /v1/files + file reference
You getA model answerText per pageA file id; the text is not downloadable
InputJPEG, PNG, GIF, WebPPDF, DOC, DOCX, PPT, PPTX, PNG, JPEG, WebP, GIF, BMP, TIFFPDF, DOC, DOCX, PPT, PPTX, PNG, JPEG, WebP, GIF, BMP, TIFF
BillingModel input tokens$0.675 per 1,000 pages$0.675 per 1,000 pages, once; then input tokens
Choose it whenThe visual content matters: photos, charts, screenshots.You need the text in your own system.You want to converse about long documents, repeatedly.

They can be combined: OCR to keep the text in your database, and document parsing so your users can ask about the same file.

Audio and Voice

Text to speech
Turns text into spoken audio.

POST /v1/tools/tts takes text and returns the audio in the response body. The language is detected from the text. By default Markdown formatting (asterisks, hashes) is removed so it is not read aloud.

At a glance
EndpointPOST /v1/tools/tts (JSON)
ModelsNo chat model involved
ProtocolsREST only
AuthenticationAuthorization: Bearer <key>
Rate limit30 requests per minute per key; above it, 429 with a retry-after header
LanguagesChinese, Cantonese, English, Japanese, Korean, Malay, Arabic, Indonesian, Thai and Vietnamese
StreamingNo: the audio arrives complete
Billing unitCharacter of text

Examples

FieldValuesDescription
textstring, requiredUp to 10,000 billed characters per request.
voicestella | tideVoice. Default stella.
formatwav | pcmwav (default) or headerless PCM: 16-bit, mono, 24 kHz.
filter_markdownbooleanDefault true: strips Markdown formatting before synthesis.
curl https://api.nuluai.com/v1/tools/tts \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your order has shipped and will arrive on Friday.", "voice": "stella", "format": "wav"}' \
  -D headers.txt -o speech.wav

grep -i "x-nulu" headers.txt
Response
HTTP/1.1 200 OK
content-type: audio/wav
x-nulu-billed-units: 49 characters
x-nulu-charge-cents: 0.33075

<WAV audio: 16-bit PCM, mono, 24 kHz>

Pricing

  • $0.675 per 10,000 characters
  • Promotional price; the standard price is $1.35 for the same quantity.
  • Billed characters: wide East Asian characters (Chinese, Japanese, Korean) count 2; all others, including spaces and punctuation, count 1.
  • Example: a 2,500-character text costs 2,500 × $0.675 / 10,000 = $0.1688.
  • A rejected request (blocked text, invalid parameters) or a failed one is not charged. There are no model tokens.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • Every successful response carries x-nulu-charge-cents (what was charged, in US cents) and x-nulu-billed-units (the units billed).
  • GET /v1/account/usage lists every operation and groups it under nulu-tts in summary.by_model.
  • In the dashboard, the Usage page shows the same operations with their cost.

Known limitations

  • Spanish is not on the list of supported languages. Spanish text is synthesised and intelligible, but pronunciation quality is not guaranteed: test it with your content before shipping.
  • At most 10,000 billed characters per request; split long texts by paragraph.
  • No streaming synthesis: the audio is delivered complete when it is ready.
  • Two voices (stella, tide) and two formats (wav, pcm); no MP3 and no speed control.

Common errors and troubleshooting

Error or symptomWhat to do
400 content_filterThe text was blocked by the content filter. It is not charged.
400 "text is required, up to 10000…"The text is empty or over the limit. Split it.
400 "voice must be one of…" / "format must be…"Use stella or tide, and wav or pcm.
The PCM file does not playPCM has no header: tell the player 16-bit, mono, 24,000 Hz, or ask for wav.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Reading an assistant's answers aloud.
  • Voice prompts and notifications in an application.
  • Audio versions of articles or lessons.
Speech to text
Transcribes a short audio clip to text.

POST /v1/tools/stt takes an audio file and returns its transcription and duration. The language is detected automatically among 21 languages, including Spanish, English, Portuguese, French, German, Italian, Chinese, Japanese, Korean, Russian, Arabic and Hindi.

At a glance
EndpointPOST /v1/tools/stt (multipart: file)
ModelsNo chat model involved
ProtocolsREST only
AuthenticationAuthorization: Bearer <key>
Rate limit30 requests per minute per key; above it, 429 with a retry-after header
Accepted audio16-bit PCM WAV or Ogg Opus; up to 8 MB and 120 s
StreamingNo
Billing unitSecond of audio, rounded up

Examples

curl -i https://api.nuluai.com/v1/tools/stt \
  -H "Authorization: Bearer sk_wat_your_key" \
  -F "[email protected]"
Response
HTTP/1.1 200 OK
x-nulu-billed-units: 3 seconds
x-nulu-charge-cents: 0.0145

{
  "object": "transcription",
  "text": "Your order has shipped and will arrive on Friday.",
  "duration_ms": 2760
}

Pricing

  • $0.174 per hour of audio, billed per second and rounded up to the second.
  • Promotional price; the standard price is $0.348 for the same quantity.
  • Example: a 90-second clip costs 90 × $0.174 / 3,600 = $0.00435; a 2.76 s clip is billed as 3 seconds.
  • A failed transcription or a rejected file is not charged. There are no model tokens.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • Every successful response carries x-nulu-charge-cents (what was charged, in US cents) and x-nulu-billed-units (the units billed).
  • GET /v1/account/usage lists every operation and groups it under nulu-stt in summary.by_model.
  • In the dashboard, the Usage page shows the same operations with their cost.

Known limitations

  • At most 120 seconds and 8 MB per file: split long recordings.
  • Only 16-bit PCM WAV or Ogg Opus. Convert MP3, M4A or WebM first (for example with ffmpeg).
  • It returns plain text: no timestamps, no speaker separation, and no way to choose the language.
  • No real-time transcription.

Common errors and troubleshooting

Error or symptomWhat to do
400 unsupported_audioThe file is not 16-bit PCM WAV or Ogg Opus. Convert it to 16-bit mono WAV (16 or 24 kHz both work) before sending it.
Empty transcriptionThe audio has no audible speech or the volume is very low.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Voice notes and audio messages in a chat.
  • Voice input for an assistant: speech → text → model → text to speech.
  • Transcribing short answers in forms or surveys.

Build an AI Chatbot

Conversation management
The API stores no conversations: your application sends the full history on every request.

Keep the messages in your own database. On each turn append the user message, call the API, and append the assistant turn to the history exactly as it arrived.

from openai import OpenAI

client = OpenAI(api_key="sk_wat_your_key", base_url="https://api.nuluai.com/v1")

messages = [{"role": "system", "content": "You are a concise assistant."}]

def ask(text):
    messages.append({"role": "user", "content": text})
    response = client.chat.completions.create(model="nulu-5-ultra", messages=messages, max_tokens=100)
    messages.append(response.choices[0].message)  # keep the assistant turn in the history
    return response.choices[0].message.content

print(ask("What is the highest mountain on Earth?"))
print(ask("And the second highest?"))  # the model sees the whole history
  • Every request pays for the whole history as input tokens. Context caching makes the repeated prefix cheaper; for very long conversations, summarise or trim old turns.
  • Keep the system prompt identical between turns to benefit from the cache.
  • There are no conversation ids on the server: on Responses, previous_response_id and conversation return 400.
  • Store the complete assistant turn (not only the text) if you use functions or web tools: see Multi-turn tool usage.
Streaming responses
Show the text while it is generated, with SSE events.

Send stream: true. The response arrives as data: events (Server-Sent Events); each carries a fragment in choices[0].delta.content. The stream ends with data: [DONE].

Chat Completions
curl -N https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 100,
    "stream": true,
    "stream_options": {"include_usage": true},
    "messages": [{"role": "user", "content": "Count from one to five in words."}]
  }'
Events (abridged)
data: {"id":"be281a01-...","object":"chat.completion.chunk","model":"nulu-5-ultra","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}],"usage":null}

data: {"id":"be281a01-...","object":"chat.completion.chunk","model":"nulu-5-ultra","choices":[{"index":0,"delta":{"content":"One"},"finish_reason":null}],"usage":null}

data: {"id":"be281a01-...","object":"chat.completion.chunk","model":"nulu-5-ultra","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop"}],"usage":{"prompt_tokens":237,"completion_tokens":10,"total_tokens":247}}

data: [DONE]
Other protocols
from anthropic import Anthropic

client = Anthropic(api_key="sk_wat_your_key", base_url="https://api.nuluai.com")

with client.messages.stream(
    model="nulu-5-ultra",
    max_tokens=100,
    messages=[{"role": "user", "content": "Count from one to five in words."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)
    usage = stream.get_final_message().usage
print("\ntokens:", usage.input_tokens, "+", usage.output_tokens)
  • The last chunk carries finish_reason and usage. With the SDKs, ask for stream_options: {"include_usage": true} to receive it.
  • With thinking on, the reasoning arrives before the text in delta.reasoning_content.
  • Lines that start with : (for example : keep-alive) are SSE comments: ignore them.
  • Streaming costs the same as a complete response: the same tokens are billed.
  • Always stream deep thinking search and long answers: non-streaming requests are limited to ~95 s.
Citations
Link each statement of the answer to the source that supports it.

When the model searches the web, the response carries message.annotations. Each citation gives a URL, its title and the span of text it supports: start_index (inclusive) and end_index (exclusive) are character positions in message.content.

"annotations": [{
  "type": "url_citation",
  "url_citation": {
    "url": "https://docs.python.org/3/whatsnew/3.13.html",
    "title": "What's New In Python 3.13",
    "start_index": 0,
    "end_index": 45
  }
}]
Insert numbered markers
from openai import OpenAI

client = OpenAI(api_key="sk_wat_your_key", base_url="https://api.nuluai.com/v1")

response = client.chat.completions.create(
    model="nulu-5-ultra",
    max_tokens=300,
    tools=[{"type": "web_search"}],
    messages=[{"role": "user", "content": "When was Python 3.13 released? One sentence."}],
)
message = response.choices[0].message
text = message.content

# Each annotation marks the span of the answer [start_index, end_index) that a source supports.
# Insert numbered markers from the end of the text so earlier offsets stay valid.
sources = []
for annotation in sorted(message.annotations or [], key=lambda a: a.url_citation.end_index, reverse=True):
    citation = annotation.url_citation
    if citation.url not in sources:
        sources.append(citation.url)
    marker = " [" + str(sources.index(citation.url) + 1) + "]"
    text = text[:citation.end_index] + marker + text[citation.end_index:]

print(text)
for number, url in enumerate(sources, start=1):
    print("[" + str(number) + "]", url)
  • Insert the markers from the end of the text backwards so earlier positions stay valid.
  • When streaming, citations arrive complete on the last chunk (delta.annotations): show the text first and add the citations at the end.
  • Responses delivers them in output_text.annotations; Messages, in citations on each text block (and citations_delta while streaming).
  • All consulted sources, cited or not, are in server_tool_calls[].calls[].sources.
  • An answer without a search has no citations: treat annotations as optional. Citations have no cost of their own.
Conversation titles
A short title for the conversation, generated in the same request.

Send title: {"enabled": true} on the first request of a conversation. The response includes a short title for your chat list. No second model call is needed.

At a glance
Modelsnulu-5-ultra, nulu-5-pro
Chat Completionsmessage.title; when streaming, delta.title on the last chunk
Messagestop-level title; when streaming, message_delta.delta.title
Responsestop-level title
AuthenticationAuthorization: Bearer <key> (Messages also accepts x-api-key)
Rate limit120 model requests per minute per key; above it, 429 with a retry-after header
Billing unitFree

Examples

curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 100,
    "title": {"enabled": true},
    "messages": [{"role": "user", "content": "How do I bake sourdough bread at home? Two sentences."}]
  }'
Response (abridged)
{
  "choices": [{
    "index": 0,
    "finish_reason": "stop",
    "message": {
      "role": "assistant",
      "content": "Mix flour, water, salt and an active starter ...",
      "title": "Sourdough baking steps"
    }
  }]
}

Pricing

  • The title is free: it adds no charge and no billed tokens to the request.
  • The request itself is billed as usual, by its input and output tokens. Example: a request costs the same with or without a title.
  • A rejected request (4xx) is not charged.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • The cost is in the tokens: usage.prompt_tokens (input) and usage.completion_tokens (output) of the same response.
  • GET /v1/account/usage returns every request with its tokens and charge_usd; the dashboard Usage page shows the same.

Known limitations

  • The title can be absent (for example, when the answer was a refusal or an error occurred): fall back to the start of the first message.
  • Ask for it on the first request only; later it is not needed and the title could change.
  • The length and style of the title cannot be set.

Common errors and troubleshooting

Error or symptomWhat to do
title is missing from the responseCheck that you sent title: {"enabled": true} (in the Python SDK, inside extra_body) and apply the fallback.
No title while streamingIt arrives on the last chunk, with finish_reason. Read delta.title there.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • The conversation list of a chat application.
  • Automatic subjects for tickets or notes.
User context marker
Tell the model today's date, the language and, only if you choose to, the user's location.

The model does not know what day it is or where the user is. The marker is a message with role: "latest_reminder" placed directly before the user message it belongs to. Its content is five comma-separated fields: <date>,<weekday>,<location>,<platform>,<language>.

Privacy: Nulu AI does not add a location by itself and does not derive one from the connection. The model knows the location only if your application sends it in the marker, and it is not stored beyond the normal request logs. Send it only with the user's consent; the field may be empty.

At a glance
Modelsnulu-5-ultra, nulu-5-pro
ProtocolsChat Completions and Messages. Not available on Responses.
AuthenticationAuthorization: Bearer <key> (Messages also accepts x-api-key)
Rate limit120 model requests per minute per key; above it, 429 with a retry-after header
Billing unitModel input tokens (a few)

Examples

FieldFormatExample
DateYYYY-MM-DD2026-12-03
WeekdayThe weekday of that date, written in the marker language and capitalisedThursday / Jueves
LocationFree text, optional (may be empty)Caracas
PlatformApp | WebWeb
LanguageNative name of the user's languageEnglish / español
Chat Completions
curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 100,
    "messages": [
      {"role": "latest_reminder", "content": "2026-12-03,Jueves,Caracas,Web,español"},
      {"role": "user", "content": "What day is it today, and where am I?"}
    ]
  }'
from anthropic import Anthropic

client = Anthropic(api_key="sk_wat_your_key", base_url="https://api.nuluai.com")

message = client.messages.create(
    model="nulu-5-ultra",
    max_tokens=100,
    messages=[
        {"role": "latest_reminder", "content": "2026-12-03,Thursday,,App,English"},
        {"role": "user", "content": "What is today's date?"},
    ],
)
print(message.content[0].text)

Pricing

  • No charge of its own: the marker adds about 15–25 input tokens to the request ($0.45 per 1M on Nulu 5 Ultra).
  • Example: 20 extra input tokens cost 20 × $0.45 / 1M + 0 × $1.80 / 1M = $0.000009.
  • A marker with an invalid format returns 400 and is not charged.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • The cost is in the tokens: usage.prompt_tokens (input) and usage.completion_tokens (output) of the same response.
  • GET /v1/account/usage returns every request with its tokens and charge_usd; the dashboard Usage page shows the same.

Known limitations

  • It does not work on the Responses protocol.
  • The weekday must match the date and be written in the stated language; if it does not, the request is rejected and the error message states the expected value.
  • The language is given by its native name. Verified: English (with Thursday) and español (with Jueves). An unknown name returns 400.
  • It goes directly before the user message it refers to; on each new turn send an updated marker.

Common errors and troubleshooting

Error or symptomWhat to do
400 "unknown language …"Use the native name of the language: English, español.
400 "weekday … does not match date"Compute the weekday from the date and write it in the marker language (the error states the expected value).
400 "unknown platform …"The platform can only be App or Web.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Making "today", "tomorrow" or "this week" mean the right thing.
  • Current-events web searches with the real date.
  • Local answers (weather, opening hours, currency) when the user shares their city.
Content safety
Reinforced review of what goes into and comes out of the model.

Every request goes through the basic checks (level: "low"). With safety_check: {"level": "high"} you ask for a stricter review of the input and of the answer, meant for products open to the public.

If the input is blocked, the request returns 400 content_filter and is not charged. If the output is blocked, the answer ends as a refusal; text already streamed is not withdrawn.

At a glance
Modelsnulu-5-ultra, nulu-5-pro
Chat CompletionsBlocked output: finish_reason: "content_filter" (and message.refusal when images were blocked)
MessagesBlocked output: stop_reason: "refusal"
ResponsesBlocked output: status: "incomplete", incomplete_details.reason: "content_filter"
AuthenticationAuthorization: Bearer <key> (Messages also accepts x-api-key)
Rate limit120 model requests per minute per key; above it, 429 with a retry-after header
Billing unitModel output tokens

Examples

curl https://api.nuluai.com/v1/chat/completions \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-5-ultra",
    "max_tokens": 100,
    "safety_check": {"level": "high"},
    "messages": [{"role": "user", "content": "Give me three tips for a safe hiking trip."}]
  }'
Responses when something is blocked
// Input blocked: HTTP 400, nothing is charged
{"error": {"message": "...", "type": "invalid_request_error", "code": "content_filter"}}

// Output blocked: HTTP 200, the answer ends as a refusal
{"choices": [{"index": 0, "finish_reason": "content_filter", "message": {"role": "assistant", "content": "..."}}],
 "usage": {"prompt_tokens": 239, "completion_tokens": 100, "total_tokens": 339,
           "completion_tokens_details": {"reasoning_tokens": 0, "safety_tokens": 12}}}

Pricing

  • No charge of its own: the review tokens are billed as output tokens ($1.80 per 1M on Nulu 5 Ultra) and are reported in usage.completion_tokens_details.safety_tokens.
  • Example: an answer with 300 input tokens and 100 output tokens, plus 12 review tokens: 300 × $0.45 / 1M + 112 × $1.80 / 1M = $0.0003366.
  • A request blocked on input (400 content_filter) is not charged. An answer blocked on output is billed for what was generated up to that point.
  • Public price list: www.nuluai.com/pricing

Tracking usage

  • usage.completion_tokens_details.safety_tokens reports the review tokens of each request.
  • GET /v1/account/usage returns every request with its tokens and charge_usd; the dashboard Usage page shows the same.

Known limitations

  • Two levels only: low (default) and high. There are no configurable categories.
  • When streaming, text already sent is not withdrawn when the output is blocked: your interface must hide or flag it on finish_reason: "content_filter".
  • It does not replace your own product rules, or human moderation where the law requires it.

Common errors and troubleshooting

Error or symptomWhat to do
400 content_filterThe input was blocked. Show the user a neutral message; do not retry with the same text.
finish_reason: "content_filter"The output was blocked. Treat the answer as incomplete.
400 "level must be low or high"Fix the value of safety_check.level.
401 invalid_api_keyThe key is missing, mistyped or revoked. Check the Authorization header.
402 insufficient_creditThe balance is below $0.50. Add balance in the dashboard; do not retry.
429You went over the per-minute limit. Wait the retry-after seconds and retry.

Use cases

  • Chats open to the public or used by minors.
  • Generated content that is published without human review.
  • Regulated sectors that require an extra control.
Multi-turn tool usage
How to continue a conversation that used web search, URL reading or functions.

One rule: send the assistant turn back exactly as it arrived. Do not rebuild it from the text. Keep server_tool_calls (or the tool blocks on Messages and Responses) with every id, signature and encrypted_content, plus tool_calls and reasoning_content when present.

Chat Completions
from openai import OpenAI

client = OpenAI(api_key="sk_wat_your_key", base_url="https://api.nuluai.com/v1")

tools = [{"type": "web_search"}]
messages = [{"role": "user", "content": "Who maintains the Python programming language? One sentence."}]

first = client.chat.completions.create(model="nulu-5-ultra", messages=messages, tools=tools, max_tokens=200)

# Echo the assistant turn exactly as it arrived: content, annotations and server_tool_calls
# with every id and signature. Do not rebuild it from the text.
messages.append(first.choices[0].message.model_dump(exclude_none=True))
messages.append({"role": "user", "content": "In which year was it founded? Answer with the year."})

second = client.chat.completions.create(model="nulu-5-ultra", messages=messages, tools=tools, max_tokens=200)
print(first.choices[0].message.content)
print(second.choices[0].message.content)
from anthropic import Anthropic

client = Anthropic(api_key="sk_wat_your_key", base_url="https://api.nuluai.com")

tools = [{"type": "web_search", "name": "web_search"}]
messages = [{"role": "user", "content": "Who maintains the Python programming language? One sentence."}]

first = client.messages.create(model="nulu-5-ultra", max_tokens=200, tools=tools, messages=messages)

# Send every content block back unchanged (server_tool_use, web_search_tool_result, text + citations).
messages.append({"role": "assistant", "content": [block.model_dump(exclude_none=True) for block in first.content]})
messages.append({"role": "user", "content": "In which year was it founded? Answer with the year."})

second = client.messages.create(model="nulu-5-ultra", max_tokens=200, tools=tools, messages=messages)
print("".join(block.text for block in second.content if block.type == "text"))
  • From earlier turns with a search, the model re-reads only the answer text, not the results: the history does not grow with every search.
  • Pages read with read_url are restored from their signature, without downloading them again. If you alter or drop the signature, the page is no longer available to the model.
  • Store the complete JSON of the assistant turn in your database, not only content.
  • Declare the same tools in tools on every turn of the conversation.
  • With your own functions: every tool_calls[].id needs its role: "tool" message with the same tool_call_id before the next user turn.

API Reference

Endpoint list
All under https://api.nuluai.com/v1.
EndpointPurposeBilling
POST /v1/chat/completionsChat (Chat Completions protocol). All chat models.Tokens
POST /v1/responsesChat (Responses protocol).Tokens
POST /v1/messagesChat (Messages protocol).Tokens
GET /v1/modelsModels available to the key.Free
POST /v1/tools/searchWeb search as JSON.Per successful request
POST /v1/tools/fetchWeb page to Markdown.Per successful request
POST /v1/tools/ocrText from images and documents.Per page
POST /v1/tools/ttsText to speech.Per character
POST /v1/tools/sttSpeech to text.Per second
POST /v1/filesUpload a file (and parse it, depending on purpose).Per parsed page; user_data free
GET /v1/files, GET /v1/files/{id}, DELETE /v1/files/{id}List, read and delete files.Free
POST /v1/images/generationsGenerate images (JSON).Per image
POST /v1/images/editsEdit images (multipart).Per image
GET /v1/accountAccount and balance of the key.Free
GET /v1/account/usageUsage history and totals.Free
GET /v1/pricingPrices in force and peak-hour status. Public, no key.Free
Request parameters
Fields of chat requests on the three protocols.

Chat Completions

FieldRequiredDescription
modelYesPublic model id.
messagesYesMessages with role (system, user, assistant, tool, latest_reminder) and content (text or text, image_url, file parts).
max_tokensNoMaximum generated tokens, reasoning included.
temperatureNoRandomness. Typical range: 0 to 2.
top_pNoNucleus sampling. Use this or temperature.
streamNotrue returns SSE events.
stream_optionsNo{"include_usage": true} adds usage at the end of the stream.
reasoning_effortNolow, medium, high or max. Turns thinking on.
thinkingNo{"type": "enabled"} or {"type": "disabled"}. Off by default.
response_formatNo{"type": "json_object"} for JSON output.
toolsNoFunctions ({"type": "function", …}) and server tools ({"type": "web_search"}, {"type": "read_url"}).
tool_choiceNoFor your own functions only; it cannot force server tools.
titleNo{"enabled": true} asks for a conversation title.
safety_checkNo{"level": "high"} for the reinforced review; low by default.

Differences on Responses and Messages

ConceptChat CompletionsResponsesMessages
Inputmessagesinput (text or list of messages)messages (+ separate system)
Output limitmax_tokensmax_output_tokensmax_tokens (required)
Thinkingreasoning_effort / thinkingreasoning.effortthinking
Web search{"type": "web_search"}{"type": "web_search"}{"type": "web_search", "name": "web_search"}
File{"type": "file", "file_id"}{"type": "input_file", "file_id"}{"type": "document", "source": {"type": "file", "file_id"}}
Imageimage_urlinput_imageimage block
Not supported—previous_response_id, conversation, background—

The parameters of each standalone API (search, fetch, OCR, speech, files) are in its own section. Unknown fields on those APIs return 400 unsupported_parameter.

Response schemas
The shape of the responses, with the Nulu AI specific fields.
Chat Completions
{
  "id": "250147e1-ee9e-468d-becb-c9d678ef809a",
  "object": "chat.completion",
  "created": 1796335292,
  "model": "nulu-5-ultra",
  "choices": [{
    "index": 0,
    "finish_reason": "stop",            // stop | length | tool_calls | content_filter
    "message": {
      "role": "assistant",
      "content": "...",
      "reasoning_content": "...",       // only with thinking on
      "tool_calls": [ ... ],            // only when the model asks for your functions
      "annotations": [ ... ],           // citations, only after a web search
      "server_tool_calls": [ ... ],     // web_search / read_url activity
      "title": "...",                   // only with title.enabled
      "refusal": "..."                  // only when images were blocked by content safety
    }
  }],
  "usage": {
    "prompt_tokens": 8028,
    "completion_tokens": 46,
    "total_tokens": 8074,
    "prompt_tokens_details": {"cached_tokens": 0},
    "completion_tokens_details": {"reasoning_tokens": 0, "safety_tokens": 0},
    "server_tool_use": {"tool_search": 3, "tool_fetch": 0, "tool_image_search": 0}
  }
}
ObjectFields
Responses (object: "response")status (completed | incomplete), incomplete_details, output[] (reasoning, web_search_call, message with content[].text and annotations), title, usage (input_tokens, output_tokens, input_tokens_details.cached_tokens, output_tokens_details.reasoning_tokens).
Messages (type: "message")content[] (thinking, text with citations, tool_use, server_tool_use, web_search_tool_result blocks), stop_reason (end_turn | max_tokens | tool_use | refusal), title, usage (input_tokens, output_tokens, cache_read_input_tokens).
search.resultquery, results[]: title, url, snippet, summary, content, site_name, site_icon, date, authority, rerank_score
fetch.resulturl, title, content (Markdown)
ocr.resultid, created, purpose, page_count, pages[]: index, text, finish_reason
transcriptiontext, duration_ms
fileid, bytes, created_at, filename, purpose, pages (when parsed), expires_at
server_tool_calls[].calls[]id, type (web_search | read_url), kind (search | deep_search | image_search | read_link), action, status (completed | failed), and depending on the case sources[], page, signature or error.code.

Headers: the standalone APIs and file uploads return x-nulu-charge-cents; the standalone APIs also return x-nulu-billed-units. x-request-id identifies the request for support.

Streaming events
Which events each protocol emits with `stream: true`.
ProtocolEvents
Chat Completionsdata: lines with chat.completion.chunk objects: delta.content, delta.reasoning_content, delta.tool_calls; choices[0].server_tool_event (call_started, call_completed, step_reasoning_done) during server tools. The last chunk carries finish_reason, usage, delta.annotations, delta.server_tool_calls and delta.title. Ends with data: [DONE].
Responsesresponse.created, response.in_progress, response.output_item.added, response.content_part.added, response.output_text.delta, response.output_text.done, response.content_part.done, response.output_item.done, response.completed (with usage). With web search: response.web_search_call.* and response.output_text.annotation.added.
Messagesmessage_start, content_block_start, content_block_delta (text, thinking, citations_delta), content_block_stop, message_delta (with stop_reason, usage and delta.title), message_stop, and an occasional ping. Server tools arrive as content blocks.

Code samples are in Streaming responses and in Web search.

Error codes
What each error means and whether to retry.
Error shape
// Chat Completions, Responses and every /v1/tools and /v1/files endpoint
{"error": {"message": "Unsupported parameter: foo.", "type": "invalid_request_error", "code": "unsupported_parameter"}}

// Messages
{"type": "error", "error": {"type": "invalid_request_error", "message": "`max_tokens` is required."}}
HTTP`code`MeaningRetry?
400provider_rejected_request / —Invalid JSON or invalid parameters. The message says which.No
400unsupported_parameterUnsupported field (for example previous_response_id, or an unknown field on a standalone API).No
400unsupported_toolWeb tool with a model other than nulu-5-ultra.No
400unsupported_tool_choicetool_choice tries to force a server tool.No
400content_filterInput blocked by content safety. Not charged.No
400invalid_urlMalformed URL (Fetch API).No
400unsupported_audioAudio that is not 16-bit PCM WAV or Ogg Opus.No
401invalid_api_keyMissing, invalid or revoked key.No
402insufficient_creditBalance below $0.50.No: add balance
403url_not_allowedPrivate, internal or blocked address.No
404file_not_foundFile missing, expired or owned by another account.No
404url_not_accessiblePage unreachable, behind a sign-in or without readable content.Maybe later
404—Model not available: use an id from GET /v1/models.No
409storage_limitFile or storage limit reached.After deleting files
411—Upload without Content-Length.With a buffer or file
429—Per-minute limit exceeded. See retry-after.Yes, after retry-after
5xx—Temporary failure while processing the request. Not charged.Yes, with backoff
Error handling and retries
import time

import openai
from openai import OpenAI

client = OpenAI(api_key="sk_wat_your_key", base_url="https://api.nuluai.com/v1")

def complete(messages, attempts=3):
    for attempt in range(attempts):
        try:
            return client.chat.completions.create(model="nulu-5-ultra", messages=messages, max_tokens=50)
        except openai.RateLimitError as error:  # 429: wait for the retry-after header
            time.sleep(float(error.response.headers.get("retry-after", 2)))
        except openai.APIStatusError as error:
            if error.status_code == 402:  # insufficient_credit: do not retry
                raise RuntimeError("Add balance in the dashboard") from error
            if error.status_code < 500:   # 400 / 401 / 404: fix the request, do not retry
                raise
            time.sleep(2 ** attempt)      # 5xx: retry with backoff
    raise RuntimeError("The request kept failing")

print(complete([{"role": "user", "content": "Say OK."}]).choices[0].message.content)

try:  # the Responses protocol is stateless: stored conversations are refused
    client.responses.create(model="nulu-5-ultra", input="hi", previous_response_id="resp_123")
except openai.APIStatusError as error:
    print(error.status_code, error.code, "-", error.body["message"])
  • Retries: there are no idempotency keys. A failed operation is never charged, so retrying after an error is safe; repeating a request that succeeded is a new billable request.
  • Not every 400 error carries a code: branch on the HTTP status and log the message.
  • Inside a successful response a server tool can fail on its own: check the status and error.code of each call (url_not_accessible, url_not_allowed, unavailable).
Rate limits
Per-minute limits, per API key.
EndpointLimit per key
/v1/chat/completions, /v1/responses, /v1/messages120 requests per minute
/v1/tools/search120 per minute
/v1/tools/fetch60 per minute
/v1/tools/ocr20 per minute
/v1/tools/tts30 per minute
/v1/tools/stt30 per minute
POST /v1/files20 uploads per minute
/v1/account, /v1/account/usage60 per minute
  • Above a limit the API answers 429 with a retry-after header (seconds). Wait that long before retrying.
  • Requests rejected with 429 are not charged.
  • Other limits: 500 files and 2 GB stored per account; 20 documents per request; non-streaming requests up to ~95 s.
  • Need more? Write to support from the dashboard.
Usage accounting
How every request is measured and where to look it up.
WhereWhat it shows
usage on every model responseInput, output, cached (prompt_tokens_details.cached_tokens), reasoning and review tokens (completion_tokens_details), and server_tool_use with the number of searches and page reads.
x-nulu-charge-cents and x-nulu-billed-units headersOn the standalone APIs: what that operation was charged (US cents) and the units billed (1 request, 3 seconds, 49 characters).
GET /v1/account/usageEvery billed request with its tokens and charge_usd, the totals of the period and the breakdown per model or tool.
Dashboard → UsageThe same, with filters and charts: https://platform.nuluai.com/dashboard/usage
GET /v1/accountCurrent balance (balance_usd) and whether the key can use the API (can_use_api).
GET /v1/account/usage
curl "https://api.nuluai.com/v1/account/usage?limit=5" \
  -H "Authorization: Bearer sk_wat_your_key"
Response (abridged)
{
  "object": "list",
  "since": "2026-11-03T21:54:43.988Z",
  "until": "2026-12-03T21:54:43.988Z",
  "data": [{
    "request_id": "b3269171-c360-42ae-8bcd-b971cf620e26",
    "created_at": "2026-12-03T21:54:30.015Z",
    "model": "nulu-5-ultra",
    "status": "succeeded",
    "input_tokens": 11796,
    "cached_input_tokens": 4864,
    "output_tokens": 936,
    "reasoning_tokens": 543,
    "charge_usd": 0.00484798,
    "pricing_period": "off-peak"
  }],
  "has_more": true,
  "next_cursor": "WyIyMDI2LTEyLTAzVDIxOjU0...",
  "summary": {
    "requests": 29,
    "input_tokens": 38740,
    "cached_input_tokens": 6912,
    "output_tokens": 1614,
    "reasoning_tokens": 573,
    "charge_usd": 0.02730184,
    "by_model": [
      {"model": "nulu-5-ultra", "requests": 19, "input_tokens": 38457, "cached_input_tokens": 6784, "output_tokens": 1610, "charge_usd": 0.0172119},
      {"model": "nulu-search", "requests": 2, "input_tokens": 0, "cached_input_tokens": 0, "output_tokens": 0, "charge_usd": 0.003375}
    ]
  },
  "pending": {"requests": 0, "held_usd": 0},
  "currency": "usd"
}
  • Parameters: since and until (ISO 8601; default the last 30 days, at most a 90-day range), limit (1–100, default 50) and cursor (the next_cursor of the previous page).
  • Tools appear under the names nulu-search, nulu-fetch, nulu-ocr, nulu-document-parsing, nulu-tts and nulu-stt.
  • pricing_period says whether the request was billed at peak (peak) or off-peak (off-peak) rates. pending.held_usd is the balance held by requests in progress.
  • usage.prompt_tokens includes a short fixed platform instruction (about 230 tokens, almost always served from the cache) besides your messages.
Tool and capability pricing
Prices in force for the separately billed tools and for the integrated capabilities.
ToolEndpointPriceBilled for
Search API/v1/tools/search$2.25 per 1,000 successful requestsSuccessful request with results
Fetch API/v1/tools/fetch$2.25 per 1,000 successful requestsSuccessful request with content
OCR/v1/tools/ocr$0.675 per 1,000 pagesPage recognised
Document parsing/v1/files$0.675 per 1,000 pagesPage of a parsed document
Text to speech/v1/tools/tts$0.675 per 10,000 characters (promotional; standard $1.35)Character of text
Speech to text/v1/tools/stt$0.174 per hour of audio (promotional; standard $0.348)Second of audio
Integrated capabilityBillingDetail
Web searchModel tokensSearch results count as input tokens.
Deep thinking searchModel tokensSearch results and opened pages count as input tokens; reasoning counts as output tokens.
URL readingModel tokensPage content counts as input tokens.
File inputModel tokensThe text of a referenced file counts as input tokens. Parsing is charged once, at upload.
Conversation titleFreeNo charge.
User context markerModel tokensA few input tokens.
Content safetyModel tokensReview tokens are billed as output tokens. A request blocked on input is not charged.
  • Charges are prorated per unit, with six decimals of a cent: one operation costs exactly the price divided by the quantity in the table.
  • Failed operations are not charged. Tools and models draw from the same prepaid balance.
  • GET /v1/pricing returns these same prices as JSON (tools[], integrated[]), without a key.
curl https://api.nuluai.com/v1/pricing
Public price list: www.nuluai.com/pricing
Model pricing and billing
Prepaid balance, per-token prices and peak hours.
Chat models deduct balance by tokens (input, cached input, and output). Nulu Image 1.5 deducts per image based on size and quality; generation and editing use the same rate.
Nulu 5 Ultra pricing (per 1M tokens)
TypeOff-peakPeak
Input — cache miss$0.45$0.90
Input — cache hit$0.009$0.018
Output$1.80$3.60
Nulu 5 Pro pricing (per 1M tokens)
TypeOff-peakPeak
Input — cache miss$1.98$3.96
Input — cache hit$0.066$0.132
Output$5.94$11.88
Peak hours are Monday–Friday, 01:00–04:00 and 06:00–10:00 UTC. Weekends, Chinese public holidays and all other hours are off-peak. During peak hours the per-token rate doubles (2×). Applies to Nulu 5 Ultra and Nulu 5 Pro.
Billing example (Nulu 5 Ultra)

A request with 1M uncached input tokens + 1M output tokens costs $0.45 + $1.80 = $2.25 off-peak, and $0.90 + $3.60 = $4.50 during peak.

If those 1M input tokens were already cached: $0.009 + $1.80 = $1.809 off-peak, and $0.018 + $3.60 = $3.618 during peak.

Protocol compatibility
What changes between Chat Completions, Responses and Messages.
Chat CompletionsResponsesMessages
ModelsAll chat modelsnulu-5-ultra, nulu-5-pronulu-5-ultra, nulu-5-pro
Key headerAuthorization: BearerAuthorization: Bearerx-api-key or Authorization: Bearer
End of the answerfinish_reasonstatusstop_reason
Blocked outputfinish_reason: "content_filter"status: "incomplete"stop_reason: "refusal"
Input / output tokensprompt_tokens / completion_tokensinput_tokens / output_tokensinput_tokens / output_tokens
Cached tokensprompt_tokens_details.cached_tokensinput_tokens_details.cached_tokenscache_read_input_tokens
Error shape{"error": {…}}{"error": {…}}{"type": "error", "error": {…}}
User context markerYesNoYes

The full capability matrix is in API protocols. The price is the same on all three protocols.

Known limitations
What the API does not do today.
  • Stateless: there are no conversations stored on the server (previous_response_id, conversation and background return 400). Your application sends the history.
  • Web tools (web_search, read_url) on nulu-5-ultra only; tool_choice cannot force them.
  • Non-streaming requests are limited to ~95 s: stream deep thinking search and long answers.
  • The user context marker is not available on Responses.
  • Files: 30-day maximum retention, no download of the original or of the parsed text, 64 MB and 1,000 pages per file, 500 files and 2 GB per account.
  • Speech: text to speech without streaming, with two voices and WAV or PCM output; speech to text up to 120 s and 8 MB, 16-bit PCM WAV or Ogg Opus only, no timestamps.
  • The Search API takes queries up to 128 characters and 50 results; the Fetch API, one public URL per request.
  • JSON mode guarantees valid JSON, not a schema.
  • The standalone APIs are REST only: they are not part of the chat SDKs.

Images and Integrations

Images
Generate and edit images with Nulu Image 3.
Use the public ID `nulu-image-3`. Do not send other model names.
Generation: `POST /v1/images/generations` with JSON (`model`, `prompt`, `size`, `quality`, `n`). Editing: `POST /v1/images/edits` with `multipart/form-data` (`image`, `prompt`, optional `mask`). Responses follow the OpenAI format: `data[].url` or `data[].b64_json`.
Nulu Image 3 per-image price (generate or edit): $0.035294–$0.066178. A flat per-image price, independent of size and quality.
Nulu Image 1.5 (legacy) is billed from measured tokens, roughly $0.012291–$0.05865 per image depending on size and quality.
Nulu Image 1.5 token rates
SizeQualityGenerateEdit
1024×1024Medium$0.012371$0.012371
1024×1024Low$0.040562$0.040562
1024×1024High$0.04065$0.04065
1536×1024Low$0.058536$0.058536
1536×1024Medium$0.05865$0.05865
1536×1024High$0.012291$0.012291
2048×2048Low$0.04065$0.04065
2048×2048Medium$0.04065$0.04065
2048×2048High$0.04065$0.04065
Generate image
curl https://api.nuluai.com/v1/images/generations \
  -H "Authorization: Bearer sk_wat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nulu-image-3",
    "prompt": "Modern wooden chair in a bright studio",
    "size": "1024x1024",
    "quality": "medium",
    "n": 1
  }'
Edit image
curl https://api.nuluai.com/v1/images/edits \
  -H "Authorization: Bearer sk_wat_your_key" \
  -F "model=nulu-image-3" \
  -F "prompt=Same chair in vivid red" \
  -F "[email protected]" \
  -F "size=1024x1024"
OpenAI SDK
import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({
  apiKey: "sk_wat_your_key",
  baseURL: "https://api.nuluai.com/v1"
});

// Generate
const generated = await client.images.generate({
  model: "nulu-image-3",
  prompt: "Minimal kitchen product on a white background",
  size: "1024x1024"
});

// Edit (multipart)
const edited = await client.images.edit({
  model: "nulu-image-3",
  image: fs.createReadStream("product-photo.png"),
  prompt: "Same scene with a red finish"
});
FieldGenerationEditing
modelYes — `nulu-image-3`Yes — `nulu-image-3`
promptYesYes
imageNoYes — PNG/JPEG/WebP file
maskNoOptional — transparent PNG
sizeOptionalOptional
qualityOptional (`low`, `medium`, `high`)Optional
nOptional (1–10)Optional (1–10)
opencode custom provider
Example configuration as an OpenAI-compatible provider.
{
  "provider": {
    "world-app-technologies-api": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Nulu API",
      "options": {
        "baseURL": "https://api.nuluai.com/v1",
        "apiKey": "sk_wat_your_key"
      },
      "models": {
        "nulu-5-pro": {
          "name": "Nulu 5 Pro",
          "reasoning": true,
          "tool_call": true,
          "interleaved": { "field": "reasoning_content" },
          "limit": { "context": 1000000, "output": 384000 },
          "variants": {
            "low": { "reasoningEffort": "low" },
            "medium": { "reasoningEffort": "medium" },
            "high": { "reasoningEffort": "high" },
            "max": { "reasoningEffort": "max" }
          }
        },
        "nulu-5-ultra": {
          "name": "Nulu 5 Ultra",
          "reasoning": true,
          "tool_call": true,
          "interleaved": { "field": "reasoning_content" },
          "limit": { "context": 1000000, "output": 384000 },
          "variants": {
            "low": { "reasoningEffort": "low" },
            "medium": { "reasoningEffort": "medium" },
            "high": { "reasoningEffort": "high" },
            "max": { "reasoningEffort": "max" }
          }
        },
        "nulu-image-1.5": {
          "name": "Nulu Image 1.5 (Legacy)"
        },
        "nulu-image-3": {
          "name": "Nulu Image 3"
        }
      }
    }
  }
}
After creating a key, point `baseURL` to `https://api.nuluai.com/v1`. The model must be one of the public IDs listed above. Reasoning models include `low`, `medium`, `high`, and `max` variants: pick them in the model selector or cycle through them with the `variant_cycle` keybind.