# Prompting

The two entry points that send a prompt to a session: the synchronous call that returns the assistant message, and the async call that returns immediately and streams over the event feed.

Playground

Send these requests to your own running server. Values stay in this browser.

Not connected

Base URL  Directory _optional_  Bearer token _optional_ 

 

How this works

Start a server with `nikcli serve --hostname 127.0.0.1 --port 4096`. Requests go straight from this page to that address — the browser allows it because loopback counts as a secure origin, and the server allows it because `nikcli-ai.dev` is in its CORS allowlist.

To try things without touching your real sessions or config, start the server with `NIKCLI_TEST_HOME` pointed at a throwaway directory — see [the guided tour](/docs/guides/api-tour).

## Operations

2 endpoints, generated from the server's own [OpenAPI document](/docs/api). Every path also accepts the `directory` and `workspace` query parameters that select which instance handles the request.

<table class="api-index not-prose"><tbody><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-session-sessionID-message">/session/{sessionID}/message</a></td><td class="api-index-id">session.prompt</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-session-sessionID-prompt-async">/session/{sessionID}/prompt_async</a></td><td class="api-index-id">session.prompt_async</td></tr></tbody></table>

post /session/{sessionID}/message [#](#op-post-session-sessionID-message) `session.prompt`

Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| sessionID | path | string | required |
| directory | query | string | optional |
| workspace | query | string | optional |

Request body · required · application/json

{
  messageID?: string
  delivery?: "steer" | "queue"
  model?: {
    providerID: string
    modelID: string
  }
  agent?: string
  noReply?: boolean
  tools?: {
    \[key: string\]: boolean
  }
  format?: [OutputFormat\_1](#schema-OutputFormat_1)
  system?: string
  variant?: string
  parts: [PromptPartInput](#schema-PromptPartInput)\[\]
}

Responses

200 SessionPromptResponse application/json

{
  info: [Message\_1](#schema-Message_1)
  parts: [Part\_1](#schema-Part_1)\[\]
}

Example response from schema

{
  "info": {
    "id": "",
    "sessionID": "",
    "role": "user",
    "time": {
      "created": 0
    },
    "format": {
      "type": "text"
    },
    "summary": {
      "title": "",
      "body": "",
      "diffs": \[\]
    },
    "agent": "",
    "model": {
      "providerID": "",
      "modelID": ""
    },
    "system": "",
    "tools": {},
    "variant": ""
  },
  "parts": \[
    {
      "id": "",
      "sessionID": "",
      "messageID": "",
      "type": "text",
      "text": "",
      "synthetic": false,
      "ignored": false,
      "time": {
        "start": null,
        "end": null
      },
      "metadata": {}
    }
  \]
}

Generated from the response schema — field values are placeholders, the shape is real.

SDK example

session.prompt

ts 

1

2

3

4

5

6

```
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.session.prompt({
  ...
})
```

Try it

sessionID _path · required_  directory _query_  workspace _query_ 

Request body _application/json_ { "messageID": "", "delivery": "steer", "model": { "providerID": "", "modelID": "" }, "agent": "", "noReply": false, "tools": {}, "format": { "type": "text" }, "system": "", "variant": "", "parts": \[ { "type": "text", "text": "", "synthetic": false, "ignored": false, "time": { "start": null, "end": null }, "metadata": {}, "id": "" } \] }

---

Source: https://nikcli-ai.dev/docs/api/session-prompt
