{"id":2851,"date":"2026-02-06T17:08:25","date_gmt":"2026-02-06T17:08:25","guid":{"rendered":"https:\/\/daazlabs.com\/?page_id=2851"},"modified":"2026-02-07T10:46:25","modified_gmt":"2026-02-07T10:46:25","slug":"custom-providers","status":"publish","type":"page","link":"https:\/\/daazlabs.com\/pt\/custom-providers\/","title":{"rendered":"Custom Providers"},"content":{"rendered":"<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"custom-ai-provider-examples\">Custom AI Provider Examples<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">NewsSync PRO&#8217;s&nbsp;<strong>Custom provider<\/strong>&nbsp;option supports any&nbsp;<strong>OpenAI-compatible API<\/strong>. This means you can use alternative AI services by setting up a simple proxy or using providers that already offer OpenAI-compatible endpoints.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-what-is-openai-compatible-\">\ud83c\udfaf What is &#8220;OpenAI-compatible&#8221;?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An API is OpenAI-compatible if it:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Accepts requests at&nbsp;<code>\/v1\/chat\/completions<\/code><\/li>\n\n\n\n<li>Uses&nbsp;<code>Authorization: Bearer &lt;token&gt;<\/code>&nbsp;header<\/li>\n\n\n\n<li>Returns responses in the same JSON format as OpenAI<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Many AI providers offer this compatibility to make integration easier.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-example-1-anthropic-claude-via-cloudflare-worker-\">\ud83e\udd16 Example 1: Anthropic Claude (via Cloudflare Worker)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why Claude?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Better summarization quality than GPT-4 for some content types<\/li>\n\n\n\n<li>200K context window (vs GPT-4: 128K)<\/li>\n\n\n\n<li>Competitive pricing<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The Problem:<\/strong>&nbsp;Claude has a different API format than OpenAI, so it won&#8217;t work directly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The Solution:<\/strong>&nbsp;Create a&nbsp;<strong>free Cloudflare Worker<\/strong>&nbsp;that converts OpenAI requests \u2192 Claude format.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-by-step-setup\">Step-by-step Setup<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>\u23f1\ufe0f Time needed:<\/strong>&nbsp;10 minutes&nbsp;<strong>\ud83d\udcb0 Cost:<\/strong>&nbsp;FREE (no credit card required for Cloudflare)&nbsp;<strong>\ud83c\udf93 Skill level:<\/strong>&nbsp;Beginner-friendly (just copy &amp; paste)<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"what-you-ll-need\">What You&#8217;ll Need<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Cloudflare account<\/strong>&nbsp;(FREE) &#8211; We&#8217;ll create this in Step 1<\/li>\n\n\n\n<li><strong>Claude API key<\/strong>&nbsp;from Anthropic &#8211; We&#8217;ll get this in Step 2<\/li>\n\n\n\n<li>The code below &#8211; We&#8217;ll copy this in Step 4<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-1-create-cloudflare-account\">Step 1: Create Cloudflare Account<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to&nbsp;<strong><a href=\"https:\/\/dash.cloudflare.com\/sign-up\" target=\"_blank\" rel=\"noopener\">https:\/\/dash.cloudflare.com\/sign-up<\/a><\/strong><\/li>\n\n\n\n<li>Enter your email and create password<\/li>\n\n\n\n<li><strong>Verify email<\/strong>&nbsp;(check your inbox)<\/li>\n\n\n\n<li>You&#8217;re in! \u2705 (No credit card needed)<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-2-get-claude-api-key\">Step 2: Get Claude API Key<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to&nbsp;<strong><a href=\"https:\/\/console.anthropic.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/console.anthropic.com\/<\/a><\/strong><\/li>\n\n\n\n<li>Sign up or log in<\/li>\n\n\n\n<li>Click&nbsp;<strong>&#8220;API Keys&#8221;<\/strong>&nbsp;in left menu<\/li>\n\n\n\n<li>Click&nbsp;<strong>&#8220;Create Key&#8221;<\/strong><\/li>\n\n\n\n<li><strong>Copy the key<\/strong>&nbsp;(starts with&nbsp;<code>sk-ant-api...<\/code>) \u2192 Save it somewhere safe!<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1&nbsp;<strong>Note:<\/strong>&nbsp;If you don&#8217;t have credits, you may need to add payment method. Claude offers&nbsp;<strong>$5 free credits<\/strong>&nbsp;for new users.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-3-create-your-worker-in-cloudflare\">Step 3: Create Your Worker in Cloudflare<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to&nbsp;<strong><a href=\"https:\/\/dash.cloudflare.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/dash.cloudflare.com\/<\/a><\/strong>&nbsp;(you should be logged in)<\/li>\n\n\n\n<li>In the left sidebar, click&nbsp;<strong>&#8220;Workers &amp; Pages&#8221;<\/strong><\/li>\n\n\n\n<li>Click the blue button&nbsp;<strong>&#8220;Create application&#8221;<\/strong><\/li>\n\n\n\n<li>Click&nbsp;<strong>&#8220;Create Worker&#8221;<\/strong><\/li>\n\n\n\n<li>Give it a name (e.g.,&nbsp;<code>claude-proxy<\/code>) \u2192 Click&nbsp;<strong>&#8220;Deploy&#8221;<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83c\udf89&nbsp;<strong>Your Worker is created!<\/strong>&nbsp;(don&#8217;t worry, we&#8217;ll add the code next)<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-4-add-the-proxy-code\">Step 4: Add the Proxy Code<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">After deploying, you&#8217;ll see a screen with your Worker. Now:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click the&nbsp;<strong>&#8220;Edit code&#8221;<\/strong>&nbsp;button (top right)<\/li>\n\n\n\n<li>You&#8217;ll see a code editor with sample code<\/li>\n\n\n\n<li><strong>Delete ALL the existing code<\/strong><\/li>\n\n\n\n<li><strong>Copy and paste<\/strong>&nbsp;this code:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ OpenAI-to-Claude proxy for NewsSync PRO\nexport default {\n  async fetch(request, env) {\n    \/\/ Only allow POST to \/v1\/chat\/completions\n    if (request.method !== 'POST' || !request.url.endsWith('\/v1\/chat\/completions')) {\n      return new Response('Not Found', { status: 404 });\n    }\n\n    try {\n      \/\/ Parse OpenAI-format request\n      const openaiBody = await request.json();\n\n      \/\/ Convert to Claude format\n      const claudeRequest = {\n        model: \"claude-3-5-sonnet-20241022\",\n        max_tokens: 1024,\n        messages: openaiBody.messages\n      };\n\n      \/\/ Call Claude API\n      const claudeResp = await fetch(\"https:\/\/api.anthropic.com\/v1\/messages\", {\n        method: \"POST\",\n        headers: {\n          \"x-api-key\": env.CLAUDE_API_KEY,  \/\/ This comes from Step 5\n          \"anthropic-version\": \"2023-06-01\",\n          \"content-type\": \"application\/json\"\n        },\n        body: JSON.stringify(claudeRequest)\n      });\n\n      const claudeData = await claudeResp.json();\n\n      \/\/ Convert Claude response to OpenAI format\n      const openaiResponse = {\n        id: claudeData.id || \"claude-\" + Date.now(),\n        object: \"chat.completion\",\n        created: Math.floor(Date.now() \/ 1000),\n        model: claudeData.model,\n        choices: &#91;{\n          index: 0,\n          message: {\n            role: \"assistant\",\n            content: claudeData.content&#91;0]?.text || \"\"\n          },\n          finish_reason: claudeData.stop_reason || \"stop\"\n        }],\n        usage: {\n          prompt_tokens: claudeData.usage?.input_tokens || 0,\n          completion_tokens: claudeData.usage?.output_tokens || 0,\n          total_tokens: (claudeData.usage?.input_tokens || 0) + (claudeData.usage?.output_tokens || 0)\n        }\n      };\n\n      return new Response(JSON.stringify(openaiResponse), {\n        headers: { \"Content-Type\": \"application\/json\" }\n      });\n\n    } catch (error) {\n      return new Response(JSON.stringify({ error: error.message }), {\n        status: 500,\n        headers: { \"Content-Type\": \"application\/json\" }\n      });\n    }\n  }\n};\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click&nbsp;<strong>&#8220;Save and Deploy&#8221;<\/strong>&nbsp;(top right)<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-5-add-your-claude-api-key\">Step 5: Add Your Claude API Key<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Now we need to tell the Worker your Claude API key&nbsp;<strong>securely<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go back to your Worker dashboard (click the \u2190 arrow if in editor)<\/li>\n\n\n\n<li>Click the&nbsp;<strong>&#8220;Settings&#8221;<\/strong>&nbsp;tab<\/li>\n\n\n\n<li>Scroll down to&nbsp;<strong>&#8220;Environment Variables&#8221;<\/strong>&nbsp;section<\/li>\n\n\n\n<li>Click&nbsp;<strong>&#8220;Add variable&#8221;<\/strong><\/li>\n\n\n\n<li>Fill in:\n<ul class=\"wp-block-list\">\n<li><strong>Variable name:<\/strong>&nbsp;<code>CLAUDE_API_KEY<\/code>&nbsp;(exactly like this!)<\/li>\n\n\n\n<li><strong>Value:<\/strong>&nbsp;Paste your Claude API key from Step 2 (the&nbsp;<code>sk-ant-api...<\/code>&nbsp;key)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click&nbsp;<strong>&#8220;Save&#8221;<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udd12&nbsp;<strong>Your key is now stored securely!<\/strong>&nbsp;The Worker can access it, but nobody can see it.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-6-get-your-worker-url\">Step 6: Get Your Worker URL<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Your Worker now has a&nbsp;<strong>public URL<\/strong>&nbsp;that NewsSync will call. To find it:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to your Worker&#8217;s main page (should still be open)<\/li>\n\n\n\n<li>Look for the&nbsp;<strong>&#8220;Preview&#8221;<\/strong>&nbsp;section at the top<\/li>\n\n\n\n<li>You&#8217;ll see a URL like:&nbsp;<strong><code>https:\/\/claude-proxy.YOUR-ACCOUNT.workers.dev<\/code><\/strong><\/li>\n\n\n\n<li><strong>Copy this URL<\/strong>&nbsp;\u2192 You&#8217;ll need it for Step 7!<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1&nbsp;<strong>This URL is automatically generated<\/strong>&nbsp;by Cloudflare using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Your worker name (<code>claude-proxy<\/code>)<\/li>\n\n\n\n<li>Your account subdomain (<code>YOUR-ACCOUNT<\/code>)<\/li>\n\n\n\n<li>Cloudflare&#8217;s domain (<code>.workers.dev<\/code>)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong>&nbsp;If your account is&nbsp;<code>john123<\/code>, the URL will be:&nbsp;<code>https:\/\/claude-proxy.john123.workers.dev<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-7-configure-in-newssync-pro\">Step 7: Configure in NewsSync PRO<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Now connect your Worker to NewsSync:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>In WordPress Admin \u2192 NewsSync \u2192 AI Tab \u2192 Custom Provider:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>API URL:<\/strong>&nbsp;<code>https:\/\/claude-proxy.YOUR-ACCOUNT.workers.dev\/v1\/chat\/completions<\/code>&nbsp;<em>(paste your URL from Step 6 + add&nbsp;<code>\/v1\/chat\/completions<\/code>&nbsp;at the end)<\/em><\/li>\n\n\n\n<li><strong>API Key:<\/strong>&nbsp;Leave blank or type&nbsp;<code>dummy<\/code>&nbsp;(the Worker handles authentication)<\/li>\n\n\n\n<li><strong>Model ID:<\/strong>&nbsp;<code>claude-3-5-sonnet-20241022<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-8-test-it-\">Step 8: Test It!<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click&nbsp;<strong>&#8220;Test Custom Key&#8221;<\/strong>&nbsp;button<\/li>\n\n\n\n<li>Wait 2-3 seconds<\/li>\n\n\n\n<li>Should show: \u2705&nbsp;<strong>&#8220;API test successful&#8221;<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83c\udf89&nbsp;<strong>Done!<\/strong>&nbsp;Your NewsSync is now using Claude via your free Cloudflare Worker!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"troubleshooting\">Troubleshooting<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u274c &#8220;API test failed&#8221;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check your Worker URL is correct (should end with&nbsp;<code>\/v1\/chat\/completions<\/code>)<\/li>\n\n\n\n<li>Verify your&nbsp;<code>CLAUDE_API_KEY<\/code>&nbsp;environment variable is set correctly in Cloudflare<\/li>\n\n\n\n<li>Check Claude API key hasn&#8217;t expired<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u274c &#8220;Request timeout&#8221;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Claude&#8217;s API might be slow. Try again in 30 seconds.<\/li>\n\n\n\n<li>Check Cloudflare Worker logs: Workers dashboard \u2192 Your worker \u2192 Logs<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u274c &#8220;Error 500&#8221;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to Cloudflare Worker logs to see the error details<\/li>\n\n\n\n<li>Most common: Wrong environment variable name (must be exactly&nbsp;<code>CLAUDE_API_KEY<\/code>)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"cloudflare-worker-limits-free-tier-\">Cloudflare Worker Limits (FREE Tier)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705&nbsp;<strong>100,000 requests\/day<\/strong>&nbsp;(way more than you need!)<\/li>\n\n\n\n<li>\u2705&nbsp;<strong>10ms CPU time per request<\/strong>&nbsp;(fast enough for AI calls)<\/li>\n\n\n\n<li>\u2705&nbsp;<strong>No credit card required<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Perfect for AI summaries!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-example-2-hugging-face-for-curious-users-\">\ud83e\udd17 Example 2: Hugging Face (For Curious Users)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u26a0\ufe0f Warning:<\/strong>&nbsp;We recommend using OpenAI, GitHub, or Claude instead. Hugging Face free tier has limitations that make it unsuitable for production.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why you might try it:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 Free tier available (no credit card)<\/li>\n\n\n\n<li>\u2705 Access to open-source models (Llama, Mistral, Phi)<\/li>\n\n\n\n<li>\u2705 Good for testing\/learning<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why we don&#8217;t recommend it:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u274c&nbsp;<strong>Cold starts:<\/strong>&nbsp;5-20 seconds for first request (terrible UX)<\/li>\n\n\n\n<li>\u274c&nbsp;<strong>Quality:<\/strong>&nbsp;Models like Mixtral are worse than GPT-3.5<\/li>\n\n\n\n<li>\u274c&nbsp;<strong>Rate limits:<\/strong>&nbsp;Free tier blocks easily (1000 req\/month)<\/li>\n\n\n\n<li>\u274c&nbsp;<strong>Reliability:<\/strong>&nbsp;Models go offline, API changes frequently<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"if-you-still-want-to-try-it-\">If you still want to try it&#8230;<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"option-a-hugging-face-serverless-api-simpler-\">Option A: Hugging Face Serverless API (Simpler)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Some models offer OpenAI-compatible endpoints:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>In AI Tab \u2192 Custom Provider:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>API URL:<\/strong>&nbsp;<code>https:\/\/api-inference.huggingface.co\/models\/mistralai\/Mixtral-8x7B-Instruct-v0.1\/v1\/chat\/completions<\/code><\/li>\n\n\n\n<li><strong>API Key:<\/strong>&nbsp;Your HF token (from&nbsp;<a href=\"https:\/\/huggingface.co\/settings\/tokens\" target=\"_blank\" rel=\"noopener\">Hugging Face Settings<\/a>)<\/li>\n\n\n\n<li><strong>Model ID:<\/strong>&nbsp;<code>mistralai\/Mixtral-8x7B-Instruct-v0.1<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Test:<\/strong>&nbsp;Will likely timeout on first try (cold start). Try again after 30s.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"option-b-hugging-face-via-proxy-better-\">Option B: Hugging Face via Proxy (Better)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Like Claude, you can create a Cloudflare Worker that converts OpenAI format \u2192 HF format.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Setup (same steps as Claude example):<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create Cloudflare Worker (follow Step 3 from Claude example above)<\/li>\n\n\n\n<li>Name it&nbsp;<code>hf-proxy<\/code><\/li>\n\n\n\n<li>Click &#8220;Edit code&#8221; and paste this:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ worker.js - OpenAI-to-HuggingFace proxy\nexport default {\n  async fetch(request, env) {\n    if (request.method !== 'POST') {\n      return new Response('Method Not Allowed', { status: 405 });\n    }\n\n    try {\n      const openaiBody = await request.json();\n\n      \/\/ Convert messages to single prompt\n      const prompt = openaiBody.messages\n        .map(m =&gt; `${m.role}: ${m.content}`)\n        .join('\\n\\n');\n\n      \/\/ Call Hugging Face Inference API\n      const hfResp = await fetch(\n        \"https:\/\/api-inference.huggingface.co\/models\/mistralai\/Mixtral-8x7B-Instruct-v0.1\",\n        {\n          method: \"POST\",\n          headers: {\n            \"Authorization\": `Bearer ${env.HF_TOKEN}`,\n            \"Content-Type\": \"application\/json\"\n          },\n          body: JSON.stringify({\n            inputs: prompt,\n            parameters: {\n              max_new_tokens: 250,\n              temperature: 0.7,\n              return_full_text: false\n            }\n          })\n        }\n      );\n\n      const hfData = await hfResp.json();\n\n      \/\/ Convert to OpenAI format\n      const openaiResponse = {\n        id: \"hf-\" + Date.now(),\n        object: \"chat.completion\",\n        created: Math.floor(Date.now() \/ 1000),\n        model: \"mixtral-8x7b\",\n        choices: &#91;{\n          index: 0,\n          message: {\n            role: \"assistant\",\n            content: hfData&#91;0]?.generated_text || \"\"\n          },\n          finish_reason: \"stop\"\n        }]\n      };\n\n      return new Response(JSON.stringify(openaiResponse), {\n        headers: { \"Content-Type\": \"application\/json\" }\n      });\n\n    } catch (error) {\n      return new Response(JSON.stringify({ error: error.message }), {\n        status: 500,\n        headers: { \"Content-Type\": \"application\/json\" }\n      });\n    }\n  }\n};\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click &#8220;Save and Deploy&#8221;<\/li>\n\n\n\n<li>Go to&nbsp;<strong>Settings<\/strong>&nbsp;\u2192&nbsp;<strong>Environment Variables<\/strong><\/li>\n\n\n\n<li>Add variable:&nbsp;<code>HF_TOKEN<\/code>&nbsp;= Your Hugging Face token from&nbsp;<a href=\"https:\/\/huggingface.co\/settings\/tokens\" target=\"_blank\" rel=\"noopener\">Settings<\/a><\/li>\n\n\n\n<li>Copy your Worker URL (e.g.,&nbsp;<code>https:\/\/hf-proxy.YOUR-ACCOUNT.workers.dev<\/code>)<\/li>\n\n\n\n<li>Configure in NewsSync: Use your URL +&nbsp;<code>\/v1\/chat\/completions<\/code><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u26a0\ufe0f Remember:<\/strong>&nbsp;First request will timeout (cold start). Try again after 30s.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-example-3-other-openai-compatible-providers\">\ud83c\udf10 Example 3: Other OpenAI-Compatible Providers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Many providers offer native OpenAI compatibility (no proxy needed):<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"openrouter-ai\">OpenRouter.ai<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>URL:<\/strong>&nbsp;<code>https:\/\/openrouter.ai\/api\/v1\/chat\/completions<\/code><\/li>\n\n\n\n<li><strong>API Key:<\/strong>&nbsp;Your OpenRouter key<\/li>\n\n\n\n<li><strong>Model:<\/strong>&nbsp;<code>anthropic\/claude-3.5-sonnet<\/code>&nbsp;ou&nbsp;<code>google\/gemini-pro-1.5<\/code><\/li>\n\n\n\n<li><strong>Benefit:<\/strong>&nbsp;Access to Claude, Gemini, Llama via one API<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"together-ai\">Together.ai<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>URL:<\/strong>&nbsp;<code>https:\/\/api.together.xyz\/v1\/chat\/completions<\/code><\/li>\n\n\n\n<li><strong>API Key:<\/strong>&nbsp;Your Together key<\/li>\n\n\n\n<li><strong>Model:<\/strong>&nbsp;<code>meta-llama\/Llama-3-70b-chat-hf<\/code><\/li>\n\n\n\n<li><strong>Benefit:<\/strong>&nbsp;Fast inference, good pricing<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"groq\">Groq<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>URL:<\/strong>&nbsp;<code>https:\/\/api.groq.com\/openai\/v1\/chat\/completions<\/code><\/li>\n\n\n\n<li><strong>API Key:<\/strong>&nbsp;Your Groq key<\/li>\n\n\n\n<li><strong>Model:<\/strong>&nbsp;<code>mixtral-8x7b-32768<\/code>&nbsp;ou&nbsp;<code>llama2-70b-4096<\/code><\/li>\n\n\n\n<li><strong>Benefit:<\/strong>&nbsp;Extremely fast inference (&lt; 1s response)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"perplexity-ai\">Perplexity AI<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>URL:<\/strong>&nbsp;<code>https:\/\/api.perplexity.ai\/chat\/completions<\/code><\/li>\n\n\n\n<li><strong>API Key:<\/strong>&nbsp;Your Perplexity key<\/li>\n\n\n\n<li><strong>Model:<\/strong>&nbsp;<code>llama-3-sonar-large-32k-online<\/code><\/li>\n\n\n\n<li><strong>Benefit:<\/strong>&nbsp;Online models (can search web)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-troubleshooting\">\ud83d\udd27 Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-test-failed-timeout-\">&#8220;Test failed: Timeout&#8221;<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cause:<\/strong>&nbsp;Cold start (HF) or slow endpoint<\/li>\n\n\n\n<li><strong>Fix:<\/strong>&nbsp;Try again after 30s, or use different provider<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-test-failed-invalid-api-key-\">&#8220;Test failed: Invalid API key&#8221;<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cause:<\/strong>&nbsp;Wrong key or auth format<\/li>\n\n\n\n<li><strong>Fix:<\/strong>&nbsp;Check if provider uses&nbsp;<code>Bearer<\/code>&nbsp;auth (most do)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-test-failed-bad-response-format-\">&#8220;Test failed: Bad response format&#8221;<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cause:<\/strong>&nbsp;Provider not fully OpenAI-compatible<\/li>\n\n\n\n<li><strong>Fix:<\/strong>&nbsp;Use proxy method (Cloudflare Worker)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"summaries-are-gibberish\">Summaries are gibberish<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cause:<\/strong>&nbsp;Model doesn&#8217;t follow instructions well<\/li>\n\n\n\n<li><strong>Fix:<\/strong>&nbsp;Use better model (GPT-4, Claude) or adjust prompt<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-recommended-providers-by-use-case\">\ud83d\udcca Recommended Providers by Use Case<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Use Case<\/th><th>Provider<\/th><th>Why<\/th><\/tr><\/thead><tbody><tr><td><strong>Best Quality<\/strong><\/td><td>Claude 3.5 Sonnet<\/td><td>Superior summarization<\/td><\/tr><tr><td><strong>Best Price<\/strong><\/td><td>GitHub Copilot<\/td><td>Free with GitHub account<\/td><\/tr><tr><td><strong>Fastest<\/strong><\/td><td>Groq<\/td><td>Sub-second responses<\/td><\/tr><tr><td><strong>Most Models<\/strong><\/td><td>OpenRouter<\/td><td>Access to all major LLMs<\/td><\/tr><tr><td><strong>Learning\/Testing<\/strong><\/td><td>Hugging Face<\/td><td>Free, open-source models<\/td><\/tr><tr><td><strong>Produ\u00e7\u00e3o<\/strong><\/td><td>OpenAI GPT-4o-mini<\/td><td>Reliable, battle-tested<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-pro-tips\">\ud83d\udca1 Pro Tips<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Always test with &#8220;Test Custom Key&#8221;<\/strong>&nbsp;before enabling AI summaries<\/li>\n\n\n\n<li><strong>Start with low &#8220;AI calls per run&#8221;<\/strong>&nbsp;(3-5) to control costs<\/li>\n\n\n\n<li><strong>Cache TTL is 7 days<\/strong>&nbsp;&#8211; adjust if needed for fresh summaries<\/li>\n\n\n\n<li><strong>Monitor usage in Advanced Analytics<\/strong>&nbsp;(coming soon)<\/li>\n\n\n\n<li><strong>Use Cloudflare Workers<\/strong>&nbsp;for custom integrations (100K free requests\/day)<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"-need-help-\">\ud83c\udd98 Need Help?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>WordPress Forums:<\/strong>&nbsp;<a href=\"https:\/\/wordpress.org\/support\/plugin\/rss-newssync\/\" target=\"_blank\" rel=\"noopener\">RSS NewsSync PRO Support<\/a><\/li>\n\n\n\n<li><strong>Documentation:<\/strong>&nbsp;<a href=\"https:\/\/markdowntohtml.com\/ai-summaries.md\" target=\"_blank\" rel=\"noopener\">AI Summaries Guide<\/a><\/li>\n\n\n\n<li><strong>Issue Tracker:<\/strong>&nbsp;Report bugs via WordPress.org support<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div class=\"wp-block-buttons alignwide is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-fe0a7de2 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button is-style-fill\"><a class=\"wp-block-button__link has-text-align-center wp-element-button\" href=\"https:\/\/daazlabs.com\/pt\/docs\/\"><strong>Back to Documentation<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Custom AI Provider Examples NewsSync PRO&#8217;s&nbsp;Custom provider&nbsp;option supports any&nbsp;OpenAI-compatible API. This means you can use alternative AI services by setting up a simple proxy or using providers that already offer OpenAI-compatible endpoints. \ud83c\udfaf What is &#8220;OpenAI-compatible&#8221;? An API is OpenAI-compatible if it: Many AI providers offer this compatibility to make integration easier. \ud83e\udd16 Example 1: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2851","page","type-page","status-publish","hentry"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/pages\/2851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/comments?post=2851"}],"version-history":[{"count":6,"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/pages\/2851\/revisions"}],"predecessor-version":[{"id":2927,"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/pages\/2851\/revisions\/2927"}],"wp:attachment":[{"href":"https:\/\/daazlabs.com\/pt\/wp-json\/wp\/v2\/media?parent=2851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}