{"record":{"id":"ce7b05480236766e","repo":"supermemoryai/supermemory","slug":"responses-api-is-not-available-in-this-openai-clie","errorCode":null,"errorMessage":"Responses API is not available in this OpenAI client version","messagePattern":"Responses API is not available in this OpenAI client version","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tools/src/openai/middleware.ts","lineNumber":542,"sourceCode":"\t\t\t\t: \"\"\n\n\t\tconst memories = `${profileData}\\n${searchResultsMemories}`.trim()\n\n\t\tif (memories) {\n\t\t\tlogger.debug(`Memory content preview for ${context} API`, {\n\t\t\t\tcontent: memories,\n\t\t\t\tfullLength: memories.length,\n\t\t\t})\n\t\t}\n\n\t\treturn memories\n\t}\n\n\tconst createResponsesWithMemory = async (\n\t\tparams: Parameters<typeof originalResponsesCreate>[0],\n\t) => {\n\t\tif (!originalResponsesCreate) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Responses API is not available in this OpenAI client version\",\n\t\t\t)\n\t\t}\n\n\t\tconst input = typeof params.input === \"string\" ? params.input : \"\"\n\n\t\tif (mode !== \"profile\" && !input) {\n\t\t\tlogger.debug(\"No input found for Responses API, skipping memory search\")\n\t\t\treturn originalResponsesCreate.call(openaiClient.responses, params)\n\t\t}\n\n\t\tlogger.info(\"Starting memory search for Responses API\", {\n\t\t\tcontainerTag,\n\t\t\tcustomId,\n\t\t\tmode,\n\t\t})\n\n\t\tconst operations: Promise<unknown>[] = []","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/supermemoryai/supermemory/blob/d436792e777a99865939dd543c8d1a16d57f54ec/packages/tools/src/openai/middleware.ts#L524-L560","documentation":"createResponsesWithMemory throws when the middleware was constructed against an OpenAI client that does not expose client.responses.create. The memory-enhanced Responses API path requires a sufficiently new openai npm package.","triggerScenarios":"Wrapping an older OpenAI client (pre-Responses API, roughly < openai v4.70) and then calling client.responses.create on the wrapped client.","commonSituations":"Upgrading @supermemory/tools but pinning an old openai version; bundlers tree-shaking the responses namespace; using a custom/mock client lacking the responses property.","solutions":["Upgrade the openai package to a version that includes the Responses API (v4.7x+ or v5+)","Verify openai.responses.create exists on the raw client before wrapping","Fall back to chat.completions.create if you cannot upgrade"],"exampleFix":"// before\nconst wrapped = withSupermemory(openai, opts)\nawait wrapped.responses.create({...}) // throws\n\n// after\nbun add openai@latest\nconst wrapped = withSupermemory(openai, opts)\nawait wrapped.responses.create({...})","handlingStrategy":"type-guard","validationCode":"if (typeof openai.responses?.create !== 'function') { /* upgrade openai or use chat.completions instead */ }","typeGuard":"const hasResponsesApi = (c: unknown): c is { responses: { create: Function } } => !!(c as any)?.responses?.create","tryCatchPattern":"try { await wrapped.responses.create(p) } catch (e) { if (e instanceof Error && e.message.includes('not available')) { return await wrapped.chat.completions.create(toChatParams(p)) } throw e }","preventionTips":["Keep openai and @supermemory/tools versions in lockstep","Smoke-test the wrapped client at startup"],"tags":["openai","version-compat","responses-api","supermemory"],"backgroundTag":"incompatible-client-version","analyzedSha":"d436792e777a99865939dd543c8d1a16d57f54ec","analyzedAt":"2026-08-28T18:04:46.947Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}