<?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: Edward Li</title>
    <description>The latest articles on DEV Community by Edward Li (@edward_li_71f26791eac62b8).</description>
    <link>https://dev.to/edward_li_71f26791eac62b8</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%2F4010889%2Fd8d1c596-d15d-4eca-bd83-0a2be3931456.jpg</url>
      <title>DEV Community: Edward Li</title>
      <link>https://dev.to/edward_li_71f26791eac62b8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edward_li_71f26791eac62b8"/>
    <language>en</language>
    <item>
      <title>Five checks before connecting an OpenAI-compatible API</title>
      <dc:creator>Edward Li</dc:creator>
      <pubDate>Wed, 01 Jul 2026 13:52:03 +0000</pubDate>
      <link>https://dev.to/edward_li_71f26791eac62b8/five-checks-before-connecting-an-openai-compatible-api-3j0a</link>
      <guid>https://dev.to/edward_li_71f26791eac62b8/five-checks-before-connecting-an-openai-compatible-api-3j0a</guid>
      <description>&lt;p&gt;Most OpenAI-compatible API integration failures are configuration mismatches rather than SDK failures.&lt;/p&gt;

&lt;p&gt;Before connecting an application, I check five things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The base URL includes the correct protocol, host, and /v1 path.&lt;/li&gt;
&lt;li&gt;The API key was created by the same platform and project.&lt;/li&gt;
&lt;li&gt;The model value is the exact ID copied from the current model directory.&lt;/li&gt;
&lt;li&gt;A minimal cURL request works before SDK, LangChain, Dify, or application code is introduced.&lt;/li&gt;
&lt;li&gt;Request logs show the actual model, token usage, failure reason, and final charge.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The most common mistake is changing only the base URL while keeping an old key or model alias. That usually produces a 401, model-not-found error, or a successful request with unexpected routing and cost.&lt;/p&gt;

&lt;p&gt;Full setup checklist:&lt;br&gt;
&lt;a href="https://tacklekey.com/integrations/openai-sdk-base-url?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=openai_compatible_checklist_20260701" rel="noopener noreferrer"&gt;https://tacklekey.com/integrations/openai-sdk-base-url?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=openai_compatible_checklist_20260701&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TackleKey provides OpenAI-compatible multi-model access with pricing, request logs, balance, and cost visibility. Current model availability and pricing should always be confirmed on the live site.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>openai</category>
      <category>api</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to stop AI agent API cost spikes without rewriting your OpenAI SDK calls</title>
      <dc:creator>Edward Li</dc:creator>
      <pubDate>Wed, 01 Jul 2026 12:27:59 +0000</pubDate>
      <link>https://dev.to/edward_li_71f26791eac62b8/how-to-stop-ai-agent-api-cost-spikes-without-rewriting-your-openai-sdk-calls-15b2</link>
      <guid>https://dev.to/edward_li_71f26791eac62b8/how-to-stop-ai-agent-api-cost-spikes-without-rewriting-your-openai-sdk-calls-15b2</guid>
      <description>&lt;p&gt;AI agents are good at one thing finance teams hate: turning one user action into dozens of model calls.&lt;/p&gt;

&lt;p&gt;The painful part is that the code usually looks innocent. You set an OpenAI-compatible base URL, add a model name, and everything works in development. Then production traffic arrives and a single workflow fans out into retries, tool calls, long context windows, and fallback requests.&lt;/p&gt;

&lt;p&gt;Here is the checklist I use before letting an agent workload run unattended.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Treat base URL, API key, and model ID as one bundle
&lt;/h2&gt;

&lt;p&gt;Most migration bugs come from mixing these three values across platforms.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Base URL: the gateway endpoint, usually ending with /v1.&lt;/li&gt;
&lt;li&gt;API key: the project key from the same gateway or account.&lt;/li&gt;
&lt;li&gt;Model ID: the exact model identifier from the same model directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If one of the three comes from a different provider, the result is usually a 401, a model-not-found error, or a silent cost mismatch.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Put a cost boundary before the agent loop
&lt;/h2&gt;

&lt;p&gt;An agent loop should have a budget before it starts, not after the invoice arrives.&lt;/p&gt;

&lt;p&gt;At minimum, track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;estimated input tokens before the request;&lt;/li&gt;
&lt;li&gt;output token limits per step;&lt;/li&gt;
&lt;li&gt;retry count per task;&lt;/li&gt;
&lt;li&gt;fallback model policy;&lt;/li&gt;
&lt;li&gt;per-project or per-key quota.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to block every expensive request. The goal is to make expensive requests intentional.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Separate successful routing from cheapest routing
&lt;/h2&gt;

&lt;p&gt;The cheapest model is not useful if it fails and triggers retries. For production agents, the useful metric is closer to cheapest successful route: a route that completes the request with acceptable latency, failure rate, and total token cost.&lt;/p&gt;

&lt;p&gt;This is where an OpenAI-compatible gateway helps. You can keep SDK code stable while moving routing, logging, pricing, and fallback policy into one control plane.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Debug with the smallest possible request
&lt;/h2&gt;

&lt;p&gt;Before changing LangChain, Vercel AI SDK, custom agent code, or tool-call logic, verify the gateway with one minimal request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.tacklekey.com/v1/chat/completions &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer YOUR_PROJECT_KEY"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"model":"MODEL_ID_FROM_DIRECTORY","messages":[{"role":"user","content":"ping"}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this works, copy the same baseURL, apiKey, and model into the agent runtime. If it does not work, fix the gateway configuration before debugging the agent framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Keep logs close to billing
&lt;/h2&gt;

&lt;p&gt;For agent workloads, logs are not just observability. They are the explanation for your bill.&lt;/p&gt;

&lt;p&gt;Useful log fields include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;project key or workspace;&lt;/li&gt;
&lt;li&gt;exact model ID;&lt;/li&gt;
&lt;li&gt;prompt and completion token counts;&lt;/li&gt;
&lt;li&gt;request status and retry reason;&lt;/li&gt;
&lt;li&gt;selected route or provider;&lt;/li&gt;
&lt;li&gt;charged amount and remaining balance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without this, you can know that spend went up, but not which workflow caused it.&lt;/p&gt;

&lt;p&gt;I wrote this up as a more concrete checklist here:&lt;br&gt;
&lt;a href="https://tacklekey.com/solutions/ai-agent-api-cost-control?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=agent_api_cost_control_20260701" rel="noopener noreferrer"&gt;https://tacklekey.com/solutions/ai-agent-api-cost-control?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=agent_api_cost_control_20260701&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TackleKey is an OpenAI-compatible API gateway focused on model access, usage visibility, pricing checks, logs, and cost-control workflows. The important idea is portable even if you use a different gateway: make cost and failure behavior visible before the agent loop scales.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>openai</category>
      <category>api</category>
      <category>cost</category>
    </item>
    <item>
      <title>PostPort: local-first multi-platform publishing verification</title>
      <dc:creator>Edward Li</dc:creator>
      <pubDate>Wed, 01 Jul 2026 12:17:09 +0000</pubDate>
      <link>https://dev.to/edward_li_71f26791eac62b8/postport-local-first-multi-platform-publishing-verification-e6j</link>
      <guid>https://dev.to/edward_li_71f26791eac62b8/postport-local-first-multi-platform-publishing-verification-e6j</guid>
      <description>&lt;p&gt;PostPort is a local-first publishing automation tool that helps an operator prepare, publish, and audit content across multiple platforms.&lt;/p&gt;

&lt;p&gt;This short post is a live verification record for the DEV Community API adapter. It checks that PostPort can send a normalized content job, authenticate with a DEV API key, create a public article, and capture the resulting URL as publish evidence.&lt;/p&gt;

&lt;p&gt;The broader goal is not only to publish posts, but to maintain an evidence ledger and attribution loop so future content can be evaluated by real growth signals.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>productivity</category>
      <category>api</category>
      <category>tools</category>
    </item>
  </channel>
</rss>
