---
title: "Cursor Chat Completions"
method: POST
path: "/cursor/chat/completions"
tags: ["responses"]
---

# Cursor Chat Completions

`POST /cursor/chat/completions`

Cursor BYOK endpoint. Accepts both request shapes Cursor sends to its OpenAI-compatible
base URL and always answers in chat completions format.

Cursor agent mode sends Responses API format bodies (`input`, flat tool defs, `reasoning`,
custom tools) to the chat/completions path while expecting chat completions responses;
those are routed through the Responses API pipeline and converted back. Genuine chat
completions bodies (`messages` present) are routed through the standard chat completions
pipeline, after normalizing each level of the `tools` array and `tool_choice` to the chat
completions shapes OpenAI requires. Cursor mixes Responses API shapes into chat bodies
per level, independently: a flat tool def (`{"type": "custom", "name": "ApplyPatch", ...}`)
gets nested under `custom`, and a flat grammar format
(`{"type": "grammar", "definition", "syntax"}`) gets wrapped as
`{"type": "grammar", "grammar": {...}}` wherever it appears, including inside tool defs
Cursor already sent pre-nested.

```bash
curl -X POST http://localhost:4000/cursor/chat/completions     -H "Content-Type: application/json"     -H "Authorization: Bearer sk-1234"     -d '{
    "model": "gpt-4o",
    "input": [{"role": "user", "content": "Hello"}]
}'
Responds back in chat completions format.
```

## Response `200`

Successful Response

- unknown

---

[API](https://skmtc.dev/flock/apis/litellm-api.md) · [All operations](https://skmtc.dev/flock/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/flock/apis/litellm-api/revisions/b694deb1e459?raw)
