ask-qwksearch-api-client

Guides usage of the hey-api generated TypeScript client for the QwkSearch backend API.

74|11|Updated Jul 4, 2024
One-click install
npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill ask-qwksearch-api-client-opensourceagi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ask-qwksearch-api-client
Source: https://github.com/OpenSourceAGI/qwksearch-research-agent/tree/main/skills/ask-qwksearch-api-client
Command: npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill ask-qwksearch-api-client-opensourceagi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Calling the QwkSearch backend from TypeScript apps goes wrong in predictable ways: requests hit the wrong origin, errors never throw, responses lose their status, and regenerated clients silently ship stale builds. This Skill explains how the generated qwksearch-api-client package works so those failures are diagnosed and fixed quickly. ## Core Features & Use Cases - 85 typed SDK functions: Covers agent chat/search, chats, documents, articles, files, voice, config, MCP servers, Google Docs/Drive, NotebookLM, and accounts, all returning { data, error, request, response } without throwing by default. - Transport via api2client over grab: Adds per-call cache, retry, rate limit, timeout, dedupe, and mock options, with environment-aware baseUrl resolution for browser versus server. - Regeneration workflow: Documents the two-step openapi-ts plus api2client --rewire-only pipeline from qwksearch-openapi.json and the requirement to commit dist/. - Use Case: A server-side script gets 401s calling listChats; the Skill explains that browser calls carry the session cookie automatically while server callers must set an Authorization header on their own client. ## Quick Start Ask how to call the QwkSearch agentSearch endpoint from a Node script with caching, retries, and a custom baseUrl using the qwksearch-api-client package.

Frequently Asked Questions about ask-qwksearch-api-client

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I call the QwkSearch API from TypeScript?

Import typed functions like agentSearch or listChats from the qwksearch-api-client package and pass one options object with body, path, query, or headers. Each call returns { data, error, request, response } and does not throw unless you set throwOnError: true.

How do I add caching and retries to QwkSearch API requests?

Pass grab transport options per call, such as cache: true, cacheForTime, retryAttempts, rateLimit, or timeout. Requests go through api2client over grab rather than fetch, so these options work on every generated function.

Why do QwkSearch API requests go to the wrong origin?

The baseUrl resolver uses window.NEXT_PUBLIC_BASE_URL or location.origin in the browser, but on the server it falls back to https://qwksearch.com when NEXT_PUBLIC_BASE_URL is unset. Set that environment variable or pass a custom client with createClient.

Why is result.response undefined on a failed QwkSearch API call?

The installed grab version predates 1.6.23 and lacks the onRawResponse hook, so api2client has no raw Response to return and error is a plain HTTP error string. Check grab.supports.onRawResponse and upgrade grab.

How do I regenerate the client after an OpenAPI spec change?

Update qwksearch-openapi.json, then run bun run build:api, which runs openapi-ts, api2client --rewire-only, and vite build. Commit both src/*.gen.ts and dist/, since the package has no build script and consumers use the committed dist.

Why do server-side QwkSearch API calls return 401?

Browser calls carry the session cookie automatically, but server or CLI callers must authenticate explicitly. Create your own client and set an Authorization header via client.setConfig, which is how the VS Code extension's API-key mode works.