<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sebastian Musiał</title>
    <description>The latest articles on DEV Community by Sebastian Musiał (@sebastianmusial).</description>
    <link>https://dev.to/sebastianmusial</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1384652%2F3c716d0c-3e00-47eb-a7a6-df98a3f12ed1.png</url>
      <title>DEV Community: Sebastian Musiał</title>
      <link>https://dev.to/sebastianmusial</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sebastianmusial"/>
    <language>en</language>
    <item>
      <title>How I keep AI coding agents reviewable on an open-source library</title>
      <dc:creator>Sebastian Musiał</dc:creator>
      <pubDate>Sat, 05 Dec 2026 11:49:50 +0000</pubDate>
      <link>https://dev.to/sebastianmusial/how-i-keep-ai-coding-agents-reviewable-on-an-open-source-library-2j1p</link>
      <guid>https://dev.to/sebastianmusial/how-i-keep-ai-coding-agents-reviewable-on-an-open-source-library-2j1p</guid>
      <description>&lt;p&gt;askdare's first commit is dated 29 October 2026, and 0.8.0 came out on 2 December. In those five weeks it got eight minor releases, seven npm packages, 40 Architecture Decision Records and about 1,120 commits. About 740 of those commits carry a &lt;code&gt;Co-Authored-By: Claude&lt;/code&gt; trailer. One person maintains it. askdare is an MIT-licensed Next.js library that puts an AI chatbot on any website with one script tag, on the OpenAI Responses API (&lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;live demo&lt;/a&gt;). This post is about the setup that keeps that much agent work reviewable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why agent output needs guard rails
&lt;/h2&gt;

&lt;p&gt;A coding agent writes code faster than a person reads it. In my experience three things go wrong first. The agent works from what it remembers, and the API it remembers changed last month. It re-decides questions that were settled two weeks ago. And two agents running side by side edit the same file.&lt;/p&gt;

&lt;p&gt;What helped was plain files in the repository that every session reads, and checks that fail when a rule is broken. None of it is specific to askdare.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rules in CLAUDE.md, and the same rules as checks
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; at the root is the project's instructions for Claude Code. It has a section called "Non-negotiable rules". A few of them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Non-negotiable rules
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**OpenAI:**&lt;/span&gt;
  &lt;span class="k"&gt;- &lt;/span&gt;Only &lt;span class="sb"&gt;`packages/askdare/src/openai/`&lt;/span&gt; may import &lt;span class="sb"&gt;`openai`&lt;/span&gt;.
  &lt;span class="k"&gt;- &lt;/span&gt;Published &lt;span class="sb"&gt;`.d.ts`&lt;/span&gt; must contain no &lt;span class="sb"&gt;`openai`&lt;/span&gt; or &lt;span class="sb"&gt;`next`&lt;/span&gt; types.
  &lt;span class="k"&gt;- &lt;/span&gt;Never hardcode model IDs in the library.
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Security**&lt;/span&gt; ([ADR-0004](docs/adr/0004-threat-model.md)):
  &lt;span class="k"&gt;- &lt;/span&gt;The client never chooses the model, instructions, tools, vector stores, raw &lt;span class="sb"&gt;`file_id`&lt;/span&gt;s or conversation IDs.
  &lt;span class="k"&gt;- &lt;/span&gt;No cookies.
  &lt;span class="k"&gt;- &lt;/span&gt;No message content or PII in logs.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A rule in Markdown is a request. The rules I care most about are also enforced. Biome's import restrictions fail lint with "Only packages/askdare/src/openai/ may import openai (ADR-0002)", and a script fails the package check when a published &lt;code&gt;.d.ts&lt;/code&gt; imports &lt;code&gt;openai&lt;/code&gt; or &lt;code&gt;next&lt;/code&gt;. The workflow rules are in the same file: work on a branch, commit locally, and never push, create a remote repository or publish to npm without my explicit approval.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decisions go in ADRs
&lt;/h2&gt;

&lt;p&gt;askdare had 40 ADRs at 0.8.0. The &lt;code&gt;adr&lt;/code&gt; skill tells the agent when to write one: a change to the public API, where data lives, the threat model, packaging or a core dependency. An accepted ADR is never rewritten; a new one supersedes it and says why.&lt;/p&gt;

&lt;p&gt;This matters more with agents than with people. &lt;code&gt;CLAUDE.md&lt;/code&gt; says to read the relevant ADR before changing anything it covers, so an agent that wants to tidy up an odd-looking constraint finds the reason first. When evidence is missing, a throwaway spike ends with a &lt;code&gt;FINDINGS.md&lt;/code&gt; and a go or no-go.&lt;/p&gt;

&lt;h2&gt;
  
  
  One task file, one branch, one pull request
&lt;/h2&gt;

&lt;p&gt;The repository started with &lt;code&gt;CLAUDE.md&lt;/code&gt;, ADRs 0001 to 0008, three vendored skills and read-only MCP servers, all committed on 29 October. On 11 November I added a roadmap and an agent-ready task template as a GitHub issue template. On 17 November tasks moved into the repository as files in &lt;code&gt;tasks/&lt;/code&gt;. The rule from &lt;code&gt;tasks/README.md&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The file is the whole brief for whoever picks it up, person or agent. If it isn't enough, improve the file rather than passing context around.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is the head of a real task file for 0.9:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;# c1. "Searching the web…" while web search runs
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Status:**&lt;/span&gt; ready (once &lt;span class="sb"&gt;`release/0.9`&lt;/span&gt; exists: the maintainer creates it when the first 0.9 code task starts)
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Release:**&lt;/span&gt; 0.9
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Lane:**&lt;/span&gt; Core
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Touches hot files:**&lt;/span&gt; Yes: &lt;span class="sb"&gt;`chat/reducer.ts`&lt;/span&gt;, &lt;span class="sb"&gt;`i18n/texts.ts`&lt;/span&gt; and &lt;span class="sb"&gt;`i18n/locales/*`&lt;/span&gt;. First in 0.9's Core order; b1 starts after it.
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Changes the public API or the protocol:**&lt;/span&gt; Yes: a new text key (API snapshot, minor changeset); ADR-0006 is listed by 0.9's z1
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Depends on:**&lt;/span&gt; none
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below that come the goal, the ADRs to read, the files to change, what not to touch, and a Definition of Done that includes "&lt;code&gt;pnpm check&lt;/code&gt; passes". This task also says when to stop: if the new text costs more than 40 bytes in the headless React case, the agent stops and raises it, because later work needs that room.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ROADMAP.md&lt;/code&gt; groups tasks into lanes that can run in parallel and lists the hot files that only one task may change at a time. Each task runs on its own branch in its own worktree, its status lives in the file rather than in a chat, and the pull request that finishes it deletes the file. Up to 0.8.0, 231 pull requests were merged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Skills: written here, or vendored and pinned
&lt;/h2&gt;

&lt;p&gt;Four skills are the project's own: &lt;code&gt;typescript-conventions&lt;/code&gt;, &lt;code&gt;openai-api&lt;/code&gt;, &lt;code&gt;release&lt;/code&gt; and &lt;code&gt;adr&lt;/code&gt;. Three come from other repositories (&lt;code&gt;vercel-react-best-practices&lt;/code&gt;, &lt;code&gt;vercel-composition-patterns&lt;/code&gt; and &lt;code&gt;tsdown&lt;/code&gt;), each pinned to a commit in &lt;code&gt;.claude/skills/sources.json&lt;/code&gt; with the date it was reviewed and what was trimmed. Each starts with an overrides block, and where a skill disagrees with &lt;code&gt;CLAUDE.md&lt;/code&gt; or an ADR, the repository wins.&lt;/p&gt;

&lt;p&gt;The same file lists rejected skills. One was rejected because it "Requires an unpinned global install (npm i -g agent-browser@latest)". A skill steers an agent that runs with my permissions, so I review it the way I review a dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docs over memory
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;openai-api&lt;/code&gt; skill opens with a section titled "Check the docs first: your memory is stale". Before using any OpenAI endpoint or parameter, the agent checks the &lt;code&gt;openaiDeveloperDocs&lt;/code&gt; MCP server, because the Assistants API and Prompt objects are already shut down and models keep getting renamed. &lt;code&gt;.mcp.json&lt;/code&gt; holds only read-only servers; anything that can write to an account stays out of the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  One gate: &lt;code&gt;pnpm check&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Every task ends with the same command. From the root and the core package's &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"check"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pnpm lint &amp;amp;&amp;amp; pnpm build &amp;amp;&amp;amp; pnpm typecheck &amp;amp;&amp;amp; pnpm test &amp;amp;&amp;amp; pnpm check:packages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="nl"&gt;"check:package"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"publint --strict &amp;amp;&amp;amp; attw --pack . --profile esm-only &amp;amp;&amp;amp; node ../../scripts/check-dts-no-leak.mjs dist &amp;amp;&amp;amp; node scripts/api-snapshot.mjs &amp;amp;&amp;amp; node scripts/react-size.mjs &amp;amp;&amp;amp; tsc -p tsconfig.eject.json &amp;amp;&amp;amp; tsc -p types-test"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;publint and attw check the package as consumers will resolve it. The no-leak script is the &lt;code&gt;.d.ts&lt;/code&gt; rule from &lt;code&gt;CLAUDE.md&lt;/code&gt;. The API snapshot turns any change to the public surface into a visible diff, and &lt;code&gt;react-size.mjs&lt;/code&gt; holds the React entry to its byte budget. Tests replay recorded, redacted OpenAI streams with MSW, so they never touch the network.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live checks, with real money
&lt;/h2&gt;

&lt;p&gt;Recorded fixtures only replay what someone recorded. So before 0.7.0 and 0.8.0, the new features ran against the real API, with a key from a dedicated OpenAI project that has a hard spend limit (&lt;a href="https://github.com/boldare/askdare/blob/main/docs/live-testing.md" rel="noopener noreferrer"&gt;Live testing&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The 0.8.0 checks ran on 1 December with &lt;code&gt;gpt-6-luna&lt;/code&gt; and cost about 0.17 USD. They found two bugs, both fixed before the release:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenAI reported a Flex request with no capacity inside the stream, as &lt;code&gt;flex_unavailable&lt;/code&gt; with no HTTP status, not as the 429 the guide describes. &lt;code&gt;askdare eval&lt;/code&gt; treated it as an outage and stopped the run.&lt;/li&gt;
&lt;li&gt;Once a file in a default OpenAI conversation expired, every later turn got a 404, so the conversation failed for good. Now the chat starts a new one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both fixes were written in agent sessions. No test with recorded fixtures could have caught either bug, because nobody had recorded those responses yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I do
&lt;/h2&gt;

&lt;p&gt;Every non-merge commit I made up to 0.8.0 carries the Claude trailer: 693 of the 734 non-merge commits, and the other 41 come from Dependabot and the release bot. So I type little of the code. My part is the rest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scope.&lt;/strong&gt; 0.9's scope was "settled with the maintainer" on 2 December, as &lt;code&gt;ROADMAP.md&lt;/code&gt; puts it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review and merge.&lt;/strong&gt; Auto-merge is off; pull requests are merged by hand. Security-relevant work gets &lt;code&gt;/security-review&lt;/code&gt; and &lt;code&gt;/code-review&lt;/code&gt; first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yeses.&lt;/strong&gt; Pushing, creating the &lt;code&gt;release/0.9&lt;/code&gt; branch and publishing all wait for me. npm releases can be staged, and then a maintainer approves each version with 2FA.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calls on risk.&lt;/strong&gt; I decided to ship &lt;code&gt;@boldare/askdare-s3&lt;/code&gt; 0.1.0 without a run against AWS S3 or R2. CI covers it against MinIO, and the gap is listed in the roadmap.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What still goes wrong
&lt;/h2&gt;

&lt;p&gt;The instructions go stale. As I write this, the first paragraph of &lt;code&gt;CLAUDE.md&lt;/code&gt; still says "Status: 0.4.0 released on npm". It hasn't been updated since 21 November, four minor releases ago. &lt;code&gt;ROADMAP.md&lt;/code&gt; is current, but every session still reads the old line.&lt;/p&gt;

&lt;p&gt;Lessons have to land where the next session reads them. The &lt;code&gt;openai-api&lt;/code&gt; skill records one from askdare's tool loop: on a turn's last step, with the bot's functions switched off, a model asked for a person searched the documents until it hit &lt;code&gt;max_output_tokens&lt;/code&gt;, because nothing told it why its functions were gone. The fix was a rule appended to that step's instructions, and the skill now explains it.&lt;/p&gt;

&lt;p&gt;And estimates drift: the 0.8.0 live run showed that &lt;code&gt;askdare eval&lt;/code&gt;'s token estimate was about half of what a case really spends. That is a patch task now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents on the user's side
&lt;/h2&gt;

&lt;p&gt;The same idea ships to people who use askdare. The package includes &lt;code&gt;llms.txt&lt;/code&gt;, the docs and an &lt;code&gt;askdare&lt;/code&gt; skill. &lt;code&gt;npx @boldare/askdare init&lt;/code&gt; writes an &lt;code&gt;AGENTS.md&lt;/code&gt; that sends coding agents to &lt;code&gt;node_modules/@boldare/askdare/llms.txt&lt;/code&gt;, so they read the docs of the installed version instead of what they remember about askdare. The release checklist has a line to keep &lt;code&gt;llms.txt&lt;/code&gt; and the skill current with every release.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trade-offs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This isn't a controlled experiment. I can't say how long askdare would have taken without agents.&lt;/li&gt;
&lt;li&gt;The process costs time. Every task needs a brief, every expensive decision an ADR, and a release with new OpenAI features a live run.&lt;/li&gt;
&lt;li&gt;askdare itself has limits: it calls OpenAI only for now (OpenRouter is planned for 0.9), and it needs a Next.js app to host the chat.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your site needs a chatbot, the &lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;live demo&lt;/a&gt; shows askdare in a minute, and the &lt;a href="https://askdare.vercel.app/deploy" rel="noopener noreferrer"&gt;one-click deploy&lt;/a&gt; gives you your own copy on Vercel with your OpenAI key. askdare is MIT-licensed and made at Boldare. The setup is all in the repository: &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;tasks/&lt;/code&gt;, &lt;code&gt;.claude/skills/&lt;/code&gt; and the "Working with agents" section of &lt;code&gt;CONTRIBUTING.md&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository: &lt;a href="https://github.com/boldare/askdare" rel="noopener noreferrer"&gt;https://github.com/boldare/askdare&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;How we work with agents: &lt;a href="https://github.com/boldare/askdare/blob/main/CONTRIBUTING.md#working-with-agents" rel="noopener noreferrer"&gt;https://github.com/boldare/askdare/blob/main/CONTRIBUTING.md#working-with-agents&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Using askdare with your own coding agent: &lt;a href="https://askdare.vercel.app/docs/getting-started#working-with-an-ai-coding-agent" rel="noopener noreferrer"&gt;https://askdare.vercel.app/docs/getting-started#working-with-an-ai-coding-agent&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Live demo: &lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;https://askdare.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;One-click deploy: &lt;a href="https://askdare.vercel.app/deploy" rel="noopener noreferrer"&gt;https://askdare.vercel.app/deploy&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Sebastian Musiał (&lt;a href="https://sebastianmusial.pl/" rel="noopener noreferrer"&gt;sebastianmusial.pl&lt;/a&gt;) builds askdare at &lt;a href="https://boldare.com/" rel="noopener noreferrer"&gt;Boldare&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>typescript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Your public AI chatbot is an open wallet</title>
      <dc:creator>Sebastian Musiał</dc:creator>
      <pubDate>Fri, 04 Dec 2026 20:50:57 +0000</pubDate>
      <link>https://dev.to/sebastianmusial/your-public-ai-chatbot-is-an-open-wallet-64b</link>
      <guid>https://dev.to/sebastianmusial/your-public-ai-chatbot-is-an-open-wallet-64b</guid>
      <description>&lt;p&gt;Put a chatbot on a public page and you have published an endpoint that spends your money. Anyone can send it a message, every message is billed to your OpenAI project, and a script can send thousands of them.&lt;/p&gt;

&lt;p&gt;askdare's threat model starts from an admission. On an anonymous public endpoint, you can't tell a real visitor's request from a forged one, so a determined attacker can always use your bot as a rate-limited LLM proxy. So the goal is narrower and reachable. Bound the damage in requests, tokens and money per day, and stop the attacker from escalating to data, scripts or other people's conversations.&lt;/p&gt;

&lt;p&gt;Below are the threats I'd check in any public chatbot, whatever it's built with, and then what askdare does about each one by default. askdare is an MIT-licensed Next.js library that puts an AI chatbot on any website with one script tag, on the OpenAI Responses API, and I maintain it (&lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;live demo&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  The client chooses what it shouldn't
&lt;/h2&gt;

&lt;p&gt;The cheapest attack is a field in the request body. If the browser sends the model name, an attacker sends the most expensive one. If it sends instructions, a vector store ID or a conversation ID, they send their own or try someone else's.&lt;/p&gt;

&lt;p&gt;This isn't hypothetical for us. askdare's predecessor, &lt;code&gt;@boldare/openai-assistant&lt;/code&gt;, let the client override &lt;code&gt;assistantId&lt;/code&gt;, reflected any origin in CORS and had no authentication or rate limits. ADR-0004 calls it "effectively an open, paid proxy".&lt;/p&gt;

&lt;p&gt;In askdare the client never chooses the model, instructions, tools, vector stores, raw &lt;code&gt;file_id&lt;/code&gt; values or OpenAI conversation IDs. All of them live in &lt;code&gt;defineBot&lt;/code&gt; on the server. The browser gets only signed handles. The resume token that carries a conversation ID is encrypted, bound to the bot and the visitor, and a mismatch answers &lt;code&gt;404&lt;/code&gt;. Uploaded files come back as encrypted handles that expire after an hour, and raw file IDs are refused.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scripts that drain tokens
&lt;/h2&gt;

&lt;p&gt;Once the request can't pick the price, the attacker goes for volume. Rate limits slow one visitor down. Budgets decide what a bad day costs.&lt;/p&gt;

&lt;p&gt;askdare has both. By default each bot allows 10 messages per visitor per minute, 30 per IP, 50 turns per conversation and 1,024 output tokens per model call. On top of that sit daily token budgets: 2,000,000 tokens per bot and 200,000 per client IP, counted per UTC day. With several bots, &lt;code&gt;globalDailyTokens&lt;/code&gt; caps them together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;defineBot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// …&lt;/span&gt;
  &lt;span class="n"&gt;limits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;dailyTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1_000_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dailyTokensPerIp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50_000&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="no"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;DELETE&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createChatHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;bots&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;limits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;globalDailyTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3_000_000&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details matter more than the numbers. First, each turn reserves an estimate against every budget before the model is called, and the real usage replaces it afterwards. A turn that fails or times out keeps the estimate charged. Second, a turn whose model call has started runs to the end even if the visitor disconnects, because OpenAI keeps no record of an aborted streamed response, usage included. Disconnecting mid-answer hides nothing from the counter.&lt;/p&gt;

&lt;p&gt;Counters live in memory by default, per instance. On Vercel or with several Heroku dynos, every instance would allow the full budget, and a deployment would reset them. Use a shared store, and make production refuse to start without one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;upstashStore&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@boldare/askdare-upstash'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="no"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;DELETE&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createChatHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;bots&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;limits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;upstashStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;requireSharedStore&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;NODE_ENV&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'production'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Per-IP limits have a hole: they bound what one address can spend, not what many can. Ten addresses use up a bot's default daily budget. For a public chat that attracts scripted traffic, askdare can ask for a Cloudflare Turnstile check when a session starts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;defineBot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;turnstile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@boldare/askdare'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;defineBot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// …&lt;/span&gt;
  &lt;span class="n"&gt;security&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;allowedOrigins&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// The site key is public; the secret key comes from TURNSTILE_SECRET_KEY.&lt;/span&gt;
    &lt;span class="n"&gt;humanVerifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;turnstile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;siteKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'0x4AAAAAAA…'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The token is verified on the server, and if Cloudflare can't be reached the session is refused, so the check fails closed. A passed check covers session renewals for 24 hours, and renewing can't stretch that. The trade-off is trust. Cloudflare's script runs inside the chat with your app's access, without Subresource Integrity, because Cloudflare updates it in place. That's why it's off by default.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other sites embedding your widget
&lt;/h2&gt;

&lt;p&gt;If your widget loads on any page, anyone can put your bot on their site and let you pay for their visitors.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;security.allowedOrigins&lt;/code&gt; lists the exact origins allowed to embed the chat, such as &lt;code&gt;https://www.example.com&lt;/code&gt;. No paths, no wildcards. Your app's own origin is always allowed. The browser enforces it through the chat page's &lt;code&gt;frame-ancestors&lt;/code&gt; policy.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;frame-ancestors&lt;/code&gt; stops browsers. It doesn't stop a script calling the API directly, which is why the limits and budgets above still matter. askdare also uses no cookies: requests carry Bearer tokens and JSON bodies that need a CORS preflight it never grants.&lt;/p&gt;

&lt;h2&gt;
  
  
  Forged or replayed sessions
&lt;/h2&gt;

&lt;p&gt;If session tokens are guessable, unsigned or long-lived, the attacker mints their own or reuses one forever.&lt;/p&gt;

&lt;p&gt;askdare issues two tokens, both encrypted JWE with keys derived from &lt;code&gt;CHAT_SECRET&lt;/code&gt;. The access token lives 15 minutes and stays in memory. The resume token lives 30 days and carries the conversation, opaque to the client. Each token names its bot as audience, the key is looked up by its ID with no fallback, and the visitor ID is generated by the server. &lt;code&gt;CHAT_SECRET&lt;/code&gt; must be at least 32 characters, and a short or low-entropy secret is refused. You rotate it by moving the old value to &lt;code&gt;CHAT_SECRET_PREVIOUS&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The residual risk is written down too: anyone with physical access to a browser holding a resume token can continue that conversation for up to 30 days.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spoofed client IPs
&lt;/h2&gt;

&lt;p&gt;Per-IP limits are only as good as the IP. The leftmost &lt;code&gt;X-Forwarded-For&lt;/code&gt; value is whatever the client typed.&lt;/p&gt;

&lt;p&gt;askdare reads the client IP according to &lt;code&gt;trustProxy&lt;/code&gt;. The default, &lt;code&gt;'auto'&lt;/code&gt;, uses Vercel's headers on Vercel and otherwise trusts one proxy, which matches Heroku's router. Behind a CDN in front of Heroku, set it to the number of proxies. IPv6 addresses are grouped by /64. And never expose &lt;code&gt;next start&lt;/code&gt; directly to the internet: without a proxy that sets &lt;code&gt;X-Forwarded-For&lt;/code&gt;, clients choose their own IP and the per-IP limits stop working.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt injection and leaked instructions
&lt;/h2&gt;

&lt;p&gt;Assume visitors can make the model repeat its instructions, so put no secrets in them: no keys, no internal URLs, nothing you wouldn't put on the page.&lt;/p&gt;

&lt;p&gt;askdare keeps instructions, model and tools on the server, and clients can't send system messages. Model output is rendered as Markdown without raw HTML, and images are never loaded, only their alt text, so an injected image URL can't leak the conversation to someone else's server. Three guardrails are opt-in per bot: OpenAI moderation (&lt;code&gt;moderation&lt;/code&gt;), your own rules for messages and answers (&lt;code&gt;onInput&lt;/code&gt;, &lt;code&gt;onOutput&lt;/code&gt;), and &lt;code&gt;toolResults: 'untrusted'&lt;/code&gt; for tools that return third-party text. That last one lowers the risk of planted instructions in a web page or a ticket. It doesn't remove it, so tools that act on the visitor's behalf should wait for the visitor's approval.&lt;/p&gt;

&lt;h2&gt;
  
  
  The OpenAI side
&lt;/h2&gt;

&lt;p&gt;The last line of defence runs at OpenAI and needs no infrastructure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;dedicated project&lt;/strong&gt; for this deployment, not shared with other apps;&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;restricted API key&lt;/strong&gt; with only the permissions the chat needs (&lt;code&gt;npx @boldare/askdare doctor&lt;/code&gt; names a missing one);&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;model allowlist&lt;/strong&gt; with only the model your bot uses;&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;monthly budget with "Enforce a hard limit"&lt;/strong&gt;, plus email alerts at 50% and 80%.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Set the hard limit a little above what your askdare budgets allow in a month. The budgets then stop spending first, and the hard limit catches what they miss. OpenAI's docs say enforcement isn't instantaneous, so recorded spend can end slightly above the limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't stop
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An attacker rotating many IP addresses can still spend up to a bot's daily budget. Turnstile raises the cost of automation. It doesn't stop a person or a solving service.&lt;/li&gt;
&lt;li&gt;The budgets count tokens only. File search fees and file storage aren't in them.&lt;/li&gt;
&lt;li&gt;Guardrails fail open: a moderation outage or a hook that throws lets text through.&lt;/li&gt;
&lt;li&gt;askdare works with OpenAI only for now, and runs inside a Next.js app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The budgets are the main cost control. The OpenAI hard limit is the backstop. If you remember one thing, set both.&lt;/p&gt;

&lt;h2&gt;
  
  
  A checklist you can use on any chatbot
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] The client can't choose the model, instructions, tools, vector stores, file IDs or conversation IDs.&lt;/li&gt;
&lt;li&gt;[ ] Rate limits per visitor and per IP, and a daily token budget per bot and per IP.&lt;/li&gt;
&lt;li&gt;[ ] Counters shared across instances.&lt;/li&gt;
&lt;li&gt;[ ] A human check, if the chat is public and anonymous and attracts scripts.&lt;/li&gt;
&lt;li&gt;[ ] An exact list of sites allowed to embed the widget.&lt;/li&gt;
&lt;li&gt;[ ] Short-lived, signed session tokens from a random secret that isn't in git.&lt;/li&gt;
&lt;li&gt;[ ] Client IP read from your proxy's header, and the app never exposed without that proxy.&lt;/li&gt;
&lt;li&gt;[ ] Instructions with no secrets, and output rendered without raw HTML or remote images.&lt;/li&gt;
&lt;li&gt;[ ] A dedicated OpenAI project, a restricted key, a model allowlist and a hard spend limit with a tested alert.&lt;/li&gt;
&lt;li&gt;[ ] A kill switch you know how to flip (in askdare, &lt;code&gt;ASKDARE_DISABLED=true&lt;/code&gt; and a redeploy or restart).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;If your site needs a chatbot, the &lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;live demo&lt;/a&gt; shows askdare in a minute, and the &lt;a href="https://askdare.vercel.app/deploy" rel="noopener noreferrer"&gt;one-click deploy&lt;/a&gt; gives you your own copy on Vercel with your OpenAI key. You pay OpenAI for tokens. askdare is MIT-licensed, made at Boldare, and adds no per-conversation or per-seat fee.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository: &lt;a href="https://github.com/boldare/askdare" rel="noopener noreferrer"&gt;https://github.com/boldare/askdare&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Going-public checklist: &lt;a href="https://askdare.vercel.app/docs/going-public" rel="noopener noreferrer"&gt;https://askdare.vercel.app/docs/going-public&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Threat model: &lt;a href="https://github.com/boldare/askdare/blob/main/THREAT_MODEL.md" rel="noopener noreferrer"&gt;https://github.com/boldare/askdare/blob/main/THREAT_MODEL.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Limits and costs: &lt;a href="https://askdare.vercel.app/docs/costs" rel="noopener noreferrer"&gt;https://askdare.vercel.app/docs/costs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Guardrails: &lt;a href="https://askdare.vercel.app/docs/guardrails" rel="noopener noreferrer"&gt;https://askdare.vercel.app/docs/guardrails&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Live demo: &lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;https://askdare.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;One-click deploy: &lt;a href="https://askdare.vercel.app/deploy" rel="noopener noreferrer"&gt;https://askdare.vercel.app/deploy&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Sebastian Musiał (&lt;a href="https://sebastianmusial.pl/" rel="noopener noreferrer"&gt;sebastianmusial.pl&lt;/a&gt;) builds askdare at &lt;a href="https://boldare.com/" rel="noopener noreferrer"&gt;Boldare&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>openai</category>
      <category>nextjs</category>
      <category>ai</category>
    </item>
    <item>
      <title>Our chatbot library died with the Assistants API. So we rebuilt it.</title>
      <dc:creator>Sebastian Musiał</dc:creator>
      <pubDate>Fri, 04 Dec 2026 20:47:58 +0000</pubDate>
      <link>https://dev.to/sebastianmusial/our-chatbot-library-died-with-the-assistants-api-so-we-rebuilt-it-11ob</link>
      <guid>https://dev.to/sebastianmusial/our-chatbot-library-died-with-the-assistants-api-so-we-rebuilt-it-11ob</guid>
      <description>&lt;p&gt;On 26 August 2026, OpenAI shut down the Assistants API. &lt;code&gt;@boldare/openai-assistant&lt;/code&gt;, a NestJS module with an Angular chat widget built entirely on that API, stopped working the same day, and so did its demo and its Heroku button. The repository has 104 stars and 22 forks, and every deployment built from it broke at once. This post is about its successor, askdare, and about the parts of the move that apply to anyone leaving the Assistants API. askdare is an MIT-licensed Next.js library that puts an AI chatbot on any website with one script tag, on the OpenAI Responses API (&lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;live demo&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  What the shutdown took with it
&lt;/h2&gt;

&lt;p&gt;The Assistants API bundled four things that now live in different places. OpenAI's own migration guide maps them like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an &lt;strong&gt;assistant&lt;/strong&gt; (model, instructions, tools) becomes request configuration that you keep in your application;&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;thread&lt;/strong&gt; becomes a &lt;strong&gt;conversation&lt;/strong&gt;, which stores items: messages, tool calls and tool outputs;&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;run&lt;/strong&gt; becomes a &lt;strong&gt;response&lt;/strong&gt;, and the tool-call loop is yours to manage;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;run steps&lt;/strong&gt; become &lt;strong&gt;items&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two details matter more than the table. The call that read a thread's messages no longer works, so any history you didn't copy before the sunset is gone. And the dashboard replacement OpenAI pointed Assistants users to, reusable prompt objects, shut down as well, on 30 November 2026. If your instructions lived in an object at OpenAI, they now have to live in your code, where they get versioned, reviewed and tested like the rest of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a rewrite and not a v2
&lt;/h2&gt;

&lt;p&gt;I looked at a 2.0 of the old package first. Every layer of it touched something that no longer existed: an assistant object created at startup, run polling, thread controllers, knowledge files uploaded on boot with &lt;code&gt;.env&lt;/code&gt; rewritten at runtime. None of that maps one to one onto streamed responses and conversations.&lt;/p&gt;

&lt;p&gt;Three more reasons made it a new library with a new name (&lt;a href="https://askdare.vercel.app/docs/adr/0001-shape-and-packaging" rel="noopener noreferrer"&gt;ADR-0001&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The stack.&lt;/strong&gt; We decided to build a library for Next.js. Users of the NestJS module couldn't have upgraded in place, whatever the version number said.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The name.&lt;/strong&gt; &lt;code&gt;openai-assistant&lt;/code&gt; carried OpenAI's brand and pointed to the API that was gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leaked types.&lt;/strong&gt; The old config file imported &lt;code&gt;AssistantCreateParams&lt;/code&gt; from &lt;code&gt;openai/resources/beta&lt;/code&gt;, so OpenAI's beta types were part of our public API. The &lt;code&gt;openai&lt;/code&gt; SDK allows type-level breaking changes in minor releases, and &lt;a href="https://askdare.vercel.app/docs/adr/0002-openai-only-no-leaked-types" rel="noopener noreferrer"&gt;ADR-0002&lt;/a&gt; records issue #89 on the old repo as a build failure after an &lt;code&gt;openai&lt;/code&gt; minor bump.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also weighed the shape. A template app is the cheapest to maintain, but a fork has no update path for security fixes. A platform with an admin panel was roughly three to four times the scope before a first release. A library means every export is a long-lived contract, and in return a fix reaches every deployment with a package update. We picked the library.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like now
&lt;/h2&gt;

&lt;p&gt;You add askdare to a Next.js 16 app with &lt;code&gt;npm install @boldare/askdare zod&lt;/code&gt; and &lt;code&gt;npx @boldare/askdare init&lt;/code&gt;. The bot is a few lines you own:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// askdare.config.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;defineBot&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@boldare/askdare'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bots&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="nf"&gt;defineBot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'support'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ASKDARE_MODEL&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'You answer questions about our product. If you do not know, say so.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;security&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;allowedOrigins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'https://www.example.com'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;widget&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'aura'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Hi! How can I help?'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One route serves the chat, its API and its assets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/api/chat/[...path]/route.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createChatHandler&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@boldare/askdare/next'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;bots&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'../../../../askdare.config'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Must be a literal in this file; keep it above the bots' turn timeout (120 s by default).&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;maxDuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="no"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;DELETE&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createChatHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;bots&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And any website, built with anything, embeds it with one tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://app.example.com/api/chat/widget.js?bot=support"&lt;/span&gt; &lt;span class="na"&gt;async&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No database is required. By default, conversations live in OpenAI's Conversations API, and the visitor's browser keeps only a signed token.&lt;/p&gt;

&lt;h2&gt;
  
  
  The design choices that came from the shutdown
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Secure defaults for anonymous visitors
&lt;/h3&gt;

&lt;p&gt;A website chatbot talks to people who never signed in, so the browser is untrusted. In askdare the client never chooses the model, the instructions, the tools, vector stores, file IDs or conversation IDs. The resume token carries the conversation ID encrypted and authenticated (JWE, keyed by &lt;code&gt;CHAT_SECRET&lt;/code&gt;), so the browser can neither read nor change it. There are no cookies.&lt;/p&gt;

&lt;p&gt;Out of the box you get short-lived session tokens, rate limits, daily token budgets and an origin allowlist, and the chat runs in an iframe that only the sites in &lt;code&gt;allowedOrigins&lt;/code&gt; may embed. The old library had no sign-in and CORS open to every origin.&lt;/p&gt;

&lt;h3&gt;
  
  
  Our own streaming protocol
&lt;/h3&gt;

&lt;p&gt;The old widget received raw Assistants stream events over socket.io. askdare streams server-sent events over &lt;code&gt;POST&lt;/code&gt; in its own versioned &lt;a href="https://askdare.vercel.app/docs/protocol" rel="noopener noreferrer"&gt;protocol&lt;/a&gt;, and raw OpenAI events never reach the browser. When OpenAI changes an event, the fix lands in one mapper on the server. Owning the protocol also let us add what OpenAI doesn't offer, such as resuming an answer after a dropped connection. Every event carries a sequence number, so the client picks up where the stream stopped.&lt;/p&gt;

&lt;h3&gt;
  
  
  No OpenAI types in the public API
&lt;/h3&gt;

&lt;p&gt;Only one folder, &lt;code&gt;src/openai/&lt;/code&gt;, may import &lt;code&gt;openai&lt;/code&gt;, and a lint rule enforces it. A CI test checks that the published &lt;code&gt;.d.ts&lt;/code&gt; files contain no &lt;code&gt;openai&lt;/code&gt; or &lt;code&gt;next&lt;/code&gt; types. &lt;code&gt;openai&lt;/code&gt; is a regular dependency, not a peer, so you never manage its version. If the next API change comes, it stays inside that folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  A record for every expensive decision
&lt;/h3&gt;

&lt;p&gt;Every decision that is expensive to reverse gets an Architecture Decision Record, 40 so far. Some of them record spikes against the live API. &lt;a href="https://askdare.vercel.app/docs/adr/0003-conversation-state" rel="noopener noreferrer"&gt;ADR-0003&lt;/a&gt;, for example, measured OpenAI's server-side compaction inside a conversation at a 50,000-token threshold. The seven turns after it cost 12 to about 24 times as much as the same turns without it, because each compaction lost the prompt cache. So compaction waited, and later shipped as an opt-in for conversations kept in your own store.&lt;/p&gt;

&lt;p&gt;The first commit landed on 29 October 2026. 0.8.0 shipped on 2 December.&lt;/p&gt;

&lt;h2&gt;
  
  
  What maps to what
&lt;/h2&gt;

&lt;p&gt;If you are migrating from &lt;code&gt;@boldare/openai-assistant&lt;/code&gt;, here is part of the table from the &lt;a href="https://askdare.vercel.app/docs/migrating-from-openai-assistant" rel="noopener noreferrer"&gt;migration guide&lt;/a&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;openai-assistant 1.x&lt;/th&gt;
&lt;th&gt;askdare&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;AssistantModule.forRoot(config)&lt;/code&gt; plus &lt;code&gt;ASSISTANT_ID&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;defineBot({...})&lt;/code&gt; in &lt;code&gt;askdare.config.ts&lt;/code&gt;, served by one Next.js route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agents extending &lt;code&gt;AgentBase&lt;/code&gt;, arguments as a raw JSON string&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;defineTool&lt;/code&gt; with a Zod schema, validated before your code runs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Threads, &lt;code&gt;ThreadsController&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Conversations in the OpenAI Conversations API, with a signed token in the browser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;socket.io &lt;code&gt;ChatGateway&lt;/code&gt;, raw Assistants stream events&lt;/td&gt;
&lt;td&gt;Server-sent events over &lt;code&gt;POST&lt;/code&gt;, in askdare's versioned protocol&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Run polling&lt;/td&gt;
&lt;td&gt;Streaming Responses API calls, with limits on tool steps and a deadline per turn&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The &lt;code&gt;ai-embedded&lt;/code&gt; iframe and its &lt;code&gt;postMessage&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;One &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The same split works without askdare: keep model, instructions and tools in code, keep the conversation ID on your server or in a token the browser can't read, and stream responses instead of polling runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you lose, and what askdare doesn't do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Old conversations.&lt;/strong&gt; Threads can't be read any more, so there is nothing to import.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Text to speech.&lt;/strong&gt; Answers are text. Dictation (speech to text) is still there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assistants edited in the OpenAI dashboard.&lt;/strong&gt; Instructions live in your code now.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI only, for now.&lt;/strong&gt; A second provider path through OpenRouter is planned for 0.9 (&lt;a href="https://askdare.vercel.app/docs/adr/0026-provider-path" rel="noopener noreferrer"&gt;ADR-0026&lt;/a&gt;). Until then, every model request goes to OpenAI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next.js to host.&lt;/strong&gt; The chat needs a Next.js 16 app with the App Router on the Node.js runtime. The sites that embed it can be anything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data at OpenAI by default.&lt;/strong&gt; With the default store, conversations stay at OpenAI until deleted. Since 0.6 you can keep them in your own Postgres instead, but OpenAI still processes every model request.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You pay OpenAI for tokens. askdare is MIT-licensed and adds no per-conversation or per-seat fee.&lt;/p&gt;

&lt;h2&gt;
  
  
  Migrating in an afternoon
&lt;/h2&gt;

&lt;p&gt;Most deployments take an afternoon. The instructions, tools and knowledge files carry over:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick the Next.js app that will serve the chat, or start from the starter.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npm install @boldare/askdare zod&lt;/code&gt; and &lt;code&gt;npx @boldare/askdare init&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Move your instructions into &lt;code&gt;askdare.config.ts&lt;/code&gt; and the model into &lt;code&gt;ASKDARE_MODEL&lt;/code&gt;. Pick a current model: the one your old assistant used may be retired.&lt;/li&gt;
&lt;li&gt;Rewrite each agent as a tool. The handler body usually stays; the JSON string parsing becomes a Zod schema.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npx @boldare/askdare kb sync &amp;lt;folder&amp;gt;&lt;/code&gt; for the knowledge files and set &lt;code&gt;KB_VECTOR_STORE_ID&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Replace the embed code on your sites and list them in &lt;code&gt;security.allowedOrigins&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npx @boldare/askdare doctor&lt;/code&gt;, deploy, and remove the old NestJS service.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;If your site needs a chatbot, the &lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;live demo&lt;/a&gt; shows askdare in a minute, and the &lt;a href="https://askdare.vercel.app/deploy" rel="noopener noreferrer"&gt;one-click deploy&lt;/a&gt; gives you your own copy on Vercel with your OpenAI key. askdare is MIT-licensed and made at Boldare.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository: &lt;a href="https://github.com/boldare/askdare" rel="noopener noreferrer"&gt;https://github.com/boldare/askdare&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Live demo: &lt;a href="https://askdare.vercel.app" rel="noopener noreferrer"&gt;https://askdare.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Migration guide: &lt;a href="https://askdare.vercel.app/docs/migrating-from-openai-assistant" rel="noopener noreferrer"&gt;https://askdare.vercel.app/docs/migrating-from-openai-assistant&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;One-click deploy: &lt;a href="https://askdare.vercel.app/deploy" rel="noopener noreferrer"&gt;https://askdare.vercel.app/deploy&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Sebastian Musiał (&lt;a href="https://sebastianmusial.pl/" rel="noopener noreferrer"&gt;sebastianmusial.pl&lt;/a&gt;) builds askdare at &lt;a href="https://boldare.com/" rel="noopener noreferrer"&gt;Boldare&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>openai</category>
      <category>nextjs</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
    <item>
      <title>Create your OpenAI Assistant in NestJS</title>
      <dc:creator>Sebastian Musiał</dc:creator>
      <pubDate>Tue, 26 Mar 2024 07:57:48 +0000</pubDate>
      <link>https://dev.to/sebastianmusial/create-your-openai-assistant-in-nestjs-5hij</link>
      <guid>https://dev.to/sebastianmusial/create-your-openai-assistant-in-nestjs-5hij</guid>
      <description>&lt;p&gt;&lt;strong&gt;🦾 AI Boldare Assistant is here. Are you ready for it?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;At Boldare, community empowerment is at the core of our mission. Today, we're thrilled to give you something special—a creation that we believe belongs to everyone. Introducing the Boldare AI Assistant—a NestJS library designed to empower developers in efficiently, scalably, and swiftly creating AI assistants and AI-powered chatbots. Accessible via &lt;a href="https://github.com/boldare/openai-assistant/"&gt;GitHub&lt;/a&gt; and &lt;a href="https://www.npmjs.com/package/@boldare/openai-assistant"&gt;npm&lt;/a&gt;, this tool is set to revolutionize the development landscape.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚙️ Who is the Boldare AI Assistant for?&lt;/strong&gt;&lt;br&gt;
This versatile tool caters to anyone aiming to launch their first AI-based product using the OpenAI Assistant API. Developed from our own experiences in app development and Gen-AI integration, as well as insights from our clients, it's a tool crafted by developers, for developers. With the potential to save developers between one to two weeks in launch time, it's a game-changer for those seeking streamlined development processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔥 What does it offer?&lt;/strong&gt;&lt;br&gt;
The Boldare AI Assistant is a NestJS library specifically engineered to leverage OpenAI's Assistant capabilities. Seamlessly integrated into the NestJS ecosystem, it boasts an intuitive API, WebSockets support, and development tools that simplify AI-based interactions. Whether you're building customer service bots, virtual assistants, or interactive chatbots to elevate user experiences, this library equips you with advanced AI features with minimal effort.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 Ready to dive in?&lt;/strong&gt;&lt;br&gt;
Head over to &lt;a href="https://github.com/boldare/openai-assistant"&gt;GitHub&lt;/a&gt; or &lt;a href="https://www.npmjs.com/package/@boldare/openai-assistant"&gt;npm&lt;/a&gt; to explore more details and kickstart your app development journey with the Boldare AI Assistant! 🛠️&lt;/p&gt;

&lt;p&gt;Check it out! &lt;a href="https://github.com/boldare/openai-assistant/"&gt;https://github.com/boldare/openai-assistant/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>openai</category>
      <category>opensource</category>
      <category>chatgpt</category>
    </item>
  </channel>
</rss>
