# Chat, audio, and embeddings

Source: https://nodedocs.mor.org/consumers/chat

## Agent Instructions

- Non-browser fetches of page URLs on this site return clean Markdown (not the JS UI). Prefer `https://nodedocs.mor.org/llms-full.txt` for the full corpus, or `https://nodedocs.mor.org/llms.txt` for the index.
- Per-page Markdown is also at `<page-url>.md` (homepage: `https://nodedocs.mor.org/index.md`).
- Docs search MCP: `https://nodedocs.mor.org/mcp` (discovery: `https://nodedocs.mor.org/.well-known/mcp`).
- Never invent contract addresses, chain IDs, token addresses, or live bid/model counts. Cite Networks and tokens; link active.mor.org for live data.
- Never claim Morpheus runs inference — independent providers do. Opening a session escrows MOR; it does not spend it.

Once a session is open, you talk to the proxy-router exactly like you would talk to OpenAI: same routes, same body schemas. The only difference is the `session_id` header and the BasicAuth header for the local API.

## Headers

| Header | Required | Purpose |
|--------|----------|---------|
| `Authorization: Basic <base64(user:pass)>` | Yes | Auth to your local proxy-router. See [API auth](/reference/api-auth). |
| `session_id: 0x...` | Yes (for remote) | Which open Morpheus session to route through. Omit for the bundled local model. |
| `Content-Type` | As needed | `application/json` or `multipart/form-data`. |
| `x-morpheus-history: off` | No | Skip storing this exchange and do not prepend stored history to it, for one request only. Useful for agent / tool calls that must not pollute a chat. `on` / `default` keep the node's `PROXY_STORE_CHAT_CONTEXT` / `PROXY_FORWARD_CHAT_CONTEXT` policy; the header cannot enable history the operator turned off. |

## Chat completions

Streaming, OpenAI-compatible, model field is **set by the provider** based on `session_id`:

```bash
curl -X POST 'http://localhost:8082/v1/chat/completions' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'session_id: 0x8e12df2f764b416c0ea1936a253c2a4be01005651c2d73f22dd0d72520f93ca1' \
  -d '{
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Tell me about AI."}
    ],
    "stream": true
  }'
```

Streaming responses are SSE (`text/event-stream`); non-streaming returns `application/json`.

Vision-capable models accept the OpenAI multimodal shape — a `content` array of `{"type":"text"}` and `{"type":"image_url","image_url":{"url":"data:image/png;base64,…"}}` parts. The parts are forwarded to the provider and, when history is stored, kept in the saved chat. Whether a given model actually handles images is up to its provider.

## Audio transcriptions

`POST /v1/audio/transcriptions` — multipart form-data; the body is forwarded to the provider, so any field the provider accepts will pass through. Common fields: `file`, `language`, `response_format`, `timestamp_granularities[]`, `enable_diarization`.

```bash
curl -X POST 'http://localhost:8082/v1/audio/transcriptions' \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'session_id: 0x...' \
  -F 'file=@harvard.wav'
```

## Audio speech (TTS)

```bash
curl -X POST 'http://localhost:8082/v1/audio/speech' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'session_id: 0x...' \
  -d '{"input": "Hello world.", "voice": "af_alloy"}'
```

Response is `audio/mpeg` (or whatever `response_format` you specified).

## Embeddings

```bash
curl -X POST 'http://localhost:8082/v1/embeddings' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'session_id: 0x...' \
  -d '{"input": "The quick brown fox jumped over the lazy dog", "encoding_format": "float"}'
```

## Decisions

Structured decision / System One models use a separate route — see [Decisions](/consumers/decisions) (`POST /v1/decisions`). Do not send Decisions bodies to `/v1/chat/completions`.

## Video

Video models (`ModelType` `VIDEO`) take jobs, not prompts: you quote a job, open a session on the quoted bid for the quoted length, submit the job on that session and poll for the clip. See [Video generation](/consumers/video) (`POST /v1/video/quote`, `POST /v1/video/jobs`). The provider refuses chat, audio, embeddings and Decisions requests on a video model.

## Closing a session early

Always close manually if you are finished well before the session timer expires. Unused stake returns to your wallet on close; the used stipend day-locks until the next UTC day (`withdrawUserStakes`). See [Sessions: stake, close, claim](/concepts/sessions-stake-close-recover). On a video session, wait until every job shows a final status: an early close withholds clips not delivered yet ([Video generation](/consumers/video#close-the-session)).

```bash
curl -X POST 'http://localhost:8082/blockchain/sessions/<sessionId>/close' \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' -d '{}'
```

## Full schema

See [API endpoints](/reference/api-endpoints) for our curated subset, or [`proxy-router/docs/swagger.yaml`](https://github.com/MorpheusAIs/Morpheus-Lumerin-Node/blob/main/proxy-router/docs/swagger.yaml) for the full schema.
