Environment
- OpenCode: 1.14.41
- Provider:
@ai-sdk/openai-compatible (custom, vLLM backend)
- OS: Linux (Debian)
Description
When using a custom OpenAI-compatible provider with a vLLM backend, any tool call (Read, Edit, Bash…) fails immediately with:
Expected 'function.name' to be a string.
Root cause (confirmed via curl)
The OpenAI streaming spec sends function.name only in the first delta chunk; subsequent chunks carry "name": null. This is correct per the OpenAI API reference. OpenCode's AI SDK validates each chunk independently and rejects null as invalid.
Raw streaming response from the backend (reproduced with curl):
# Chunk 1 — name is a string ✓
data: {"choices":[{"delta":{"tool_calls":[{"index":0,"function":{"name":"read_file","arguments":""}}]}}]}
# Chunk 2 — name is null per OpenAI spec → OpenCode crashes here
data: {"choices":[{"delta":{"tool_calls":[{"index":0,"function":{"name":null,"arguments":"{\"path\": \"test"}}]}}]}
# Chunk 3
data: {"choices":[{"delta":{"tool_calls":[{"index":0,"function":{"name":null,"arguments":".py\""}}]}}]}
Adding "compatibility": "compatible" to the provider options has no effect.
Steps to reproduce
- Configure a custom provider with
npm: "@ai-sdk/openai-compatible" pointing to any OpenAI-compatible backend that streams tool calls (vLLM, LM Studio, llama.cpp server, etc.)
- Ask the model to read or edit a file
- Error is thrown on the second streaming chunk
Expected behavior
function.name: null in non-first chunks should be accepted — the client should accumulate the name from the first chunk, as the OpenAI Python SDK and most other clients do.
Workaround
None found via provider options. Using Anthropic native providers is unaffected (different code path).
Environment
@ai-sdk/openai-compatible(custom, vLLM backend)Description
When using a custom OpenAI-compatible provider with a vLLM backend, any tool call (Read, Edit, Bash…) fails immediately with:
Root cause (confirmed via curl)
The OpenAI streaming spec sends
function.nameonly in the first delta chunk; subsequent chunks carry"name": null. This is correct per the OpenAI API reference. OpenCode's AI SDK validates each chunk independently and rejectsnullas invalid.Raw streaming response from the backend (reproduced with curl):
Adding
"compatibility": "compatible"to the provider options has no effect.Steps to reproduce
npm: "@ai-sdk/openai-compatible"pointing to any OpenAI-compatible backend that streams tool calls (vLLM, LM Studio, llama.cpp server, etc.)Expected behavior
function.name: nullin non-first chunks should be accepted — the client should accumulate the name from the first chunk, as the OpenAI Python SDK and most other clients do.Workaround
None found via provider
options. Using Anthropic native providers is unaffected (different code path).