Description
The built-in perplexity-agent provider is currently failing on Opencode 1.17.4.
Any request to a Perplexity Agent model fails with:
AI_APICallError: invalid request body: json: unknown field "store"
I verified that the Perplexity Agent /v1/responses endpoint works if OpenAI-specific fields are omitted, but fails when fields such as store, temperature, include, or tool_choice are present.
The built-in provider appears to use the OpenAI AI SDK adapter:
provider: perplexity-agent
api.package: @ai-sdk/openai
api.url: https://api.perplexity.ai/v1
That adapter sends OpenAI Responses API fields that Perplexity Agent API now rejects.
I have now local workaround only: a custom plugin that strips unsupported fields from requests to https://api.perplexity.ai/v1/responses makes the provider work again, but this should be fixed upstream:
const unsupportedFields = ["store", "temperature", "include", "tool_choice"]
function sanitizeBody(body: unknown) {
if (typeof body !== "string") return body
try {
const json = JSON.parse(body)
for (const field of unsupportedFields) delete json[field]
return JSON.stringify(json)
} catch {
return body
}
}
export default async () => {
const fetchKey = Symbol.for("opencode.perplexityAgentSanitizeFetch")
const global = globalThis as typeof globalThis & { [fetchKey]?: true }
if (!global[fetchKey]) {
const originalFetch = globalThis.fetch.bind(globalThis)
globalThis.fetch = async (input, init) => {
const url = typeof input === "string" || input instanceof URL ? input.toString() : input.url
if (!url.startsWith("https://api.perplexity.ai/v1/responses")) {
return originalFetch(input, init)
}
if (init?.body) {
return originalFetch(input, { ...init, body: sanitizeBody(init.body) as BodyInit })
}
if (input instanceof Request) {
const body = sanitizeBody(await input.clone().text())
return originalFetch(new Request(input, { body: body as BodyInit }), init)
}
return originalFetch(input, init)
}
global[fetchKey] = true
}
return {}
}
Plugins
None relevant. I also reproduced this with plugins disabled / without my local workaround.
OpenCode version
1.17.4
Steps to reproduce
- Configure/authenticate the built-in
perplexity-agent provider.
- Run:
opencode run "Reply with exactly: ok" \
--model "perplexity-agent/anthropic/claude-opus-4-6" \
--print-logs \
--log-level DEBUG
- Observe the failure:
AI_APICallError: invalid request body: json: unknown field "store"
Additional direct API check:
This succeeds:
curl -sS -X POST "https://api.perplexity.ai/v1/responses" \
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-opus-4-6",
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Reply exactly: ok"
}
]
}
],
"stream": false,
"max_output_tokens": 16
}'
This fails:
curl -sS -X POST "https://api.perplexity.ai/v1/responses" \
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-opus-4-6",
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Reply exactly: ok"
}
]
}
],
"stream": false,
"max_output_tokens": 16,
"store": false
}'
Response:
{
"error": {
"message": "invalid request body: json: unknown field \"store\"",
"type": "invalid_request",
"code": 400,
"param": "store"
}
}
I also observed the same class of error for:
temperature
include
tool_choice
Expected behavior: perplexity-agent should not send OpenAI-specific Responses fields that Perplexity Agent API rejects.
Screenshot and/or share link
N/A
Operating System
Arch
Terminal
Konsole
Description
The built-in
perplexity-agentprovider is currently failing on Opencode1.17.4.Any request to a Perplexity Agent model fails with:
I verified that the Perplexity Agent /v1/responses endpoint works if OpenAI-specific fields are omitted, but fails when fields such as store, temperature, include, or tool_choice are present.
The built-in provider appears to use the OpenAI AI SDK adapter:
provider: perplexity-agent
api.package: @ai-sdk/openai
api.url: https://api.perplexity.ai/v1
That adapter sends OpenAI Responses API fields that Perplexity Agent API now rejects.
I have now local workaround only: a custom plugin that strips unsupported fields from requests to https://api.perplexity.ai/v1/responses makes the provider work again, but this should be fixed upstream:
Plugins
None relevant. I also reproduced this with plugins disabled / without my local workaround.
OpenCode version
1.17.4
Steps to reproduce
perplexity-agentprovider.AI_APICallError: invalid request body: json: unknown field "store"
Additional direct API check:
This succeeds:
This fails:
Response:
{ "error": { "message": "invalid request body: json: unknown field \"store\"", "type": "invalid_request", "code": 400, "param": "store" } }I also observed the same class of error for:
temperature
include
tool_choice
Expected behavior: perplexity-agent should not send OpenAI-specific Responses fields that Perplexity Agent API rejects.
Screenshot and/or share link
N/A
Operating System
Arch
Terminal
Konsole