# language_model: Add OpenAI Responses API custom tool support \(\#60638\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/3e976e89bc3767a776965ee4589266b63caac23d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 3e976e89bc3767a776965ee4589266b63caac23d

Requested commit: 3e976e89bc3767a776965ee4589266b63caac23d

Commit: 3e976e89bc3767a776965ee4589266b63caac23d

Tree: ecb9a5df484c0a3fccfcd5e770ceeb8bc9a0daff

Author: Ben Kunkle

Committer: GitHub

## Message

```
language_model: Add OpenAI Responses API custom tool support (#60638)

# Objective

Allow zed's language model stack to express OpenAI Responses API custom
tools (freeform text-input tools with an optional lark/regex grammar),
so downstream consumers can offer tools like a freeform `apply_patch` to
GPT models.
## Solution

- `LanguageModelRequestTool` now carries a Function-vs-Custom input
variant; `LanguageModelCustomToolFormat` models text/grammar formats.
- `LanguageModelToolUse.input` becomes a typed
`LanguageModelToolUseInput::{Json, Text}`. Serialization is tagged so
persisted Text inputs round-trip losslessly; legacy plain JSON values
still deserialize as `Json`.
- `open_ai` gains the custom tool wire types (tool definition,
`custom_tool_call`/`custom_tool_call_output` input items with
string-or-content-part outputs, output item, and
`custom_tool_call_input` delta/done stream events). The Responses event
mapper accumulates raw text deltas into `ToolUse` events, and history
replay derives custom-vs-function tool results from the matching
`ToolUse` by id.
- All non-OpenAI providers and the Chat Completions path error
explicitly when a request contains custom tools — no silent drops or
empty-schema coercions.

Release Notes:

- N/A
```

## Parents

- [55b776183d5fe47eb7dffc7dbe1f3710089f6b50](https://git.cafe/gitcafe/zed/commit/55b776183d5fe47eb7dffc7dbe1f3710089f6b50?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/3e976e89bc3767a776965ee4589266b63caac23d?format=markdown)
