export type DeleteApiV1ByokProviderArgs = {provider: 'anthropic' | 'google'}; export type DeleteApiV1ByokProviderOptions = {baseUrl?: string | undefined, APIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a stored BYOK API key for a provider * * DELETE /v1/byok/{provider} */ export const deleteApiV1ByokProvider = async (args: DeleteApiV1ByokProviderArgs, options?: DeleteApiV1ByokProviderOptions) => { const {baseUrl = "https://api.asknews.app", fetch: fetchFn = fetch, APIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (APIKey !== undefined) headers.set("Authorization", APIKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/byok/${encodeURIComponent(String(args.provider))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };