Linux 软件免费装
Banner图

AIPCF - AI Provider for Cloudflare

开发者 deshabhishek007
fitehal
更新时间 2026年10月5日 04:13
PHP版本: 8.2 及以上
WordPress版本: 7.1
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

ai alt-text cloudflare image-generation meta-description

下载

1.8.12 1.8.13 1.0.0 1.0.1 1.0.3 1.0.2 1.9.0 1.10.0 1.11.0 1.8.14 1.11.1 1.11.2

详情介绍:

AIPCF connects WordPress to Cloudflare Workers AI. Once connected, the AI features built into WordPress 7.0+ and the WordPress AI plugin run on Cloudflare's models: excerpts, titles and meta descriptions in the editor, alt text on upload, image generation. A background job fills in the meta descriptions and alt text your archive is missing. Everything runs inside Cloudflare's free daily allowance of 10,000 neurons, and a daily budget makes sure a busy day never turns into a bill. AIPCF is an independent community plugin, not an official Cloudflare or WordPress product. It was built out of need, and love for the idea that every small site should get useful AI without a bill. What it costs, measured on a live site What you get What you need
  1. A Cloudflare account. No credit card is needed for the Workers AI daily allowance.
  2. An API token created from the "Workers AI" template at dash.cloudflare.com/profile/api-tokens. For Embeddings with Cloudflare Vectorize, add the permission Account > Vectorize > Edit to it.
  3. Your Account ID, the 32-character code on the right of the Workers & Pages page in the Cloudflare dashboard.
The setup panel walks through all three, and one click applies the recommended defaults. How it stays inside the allowance Every Workers AI model The model list is read from your account and cached for 12 hours. Each entry shows context window, neurons per 1,000 tokens from your account's current price list, and whether it supports tool calling or image input. AI Gateway Enter a gateway name and requests go through Cloudflare AI Gateway for edge caching, rate limits, spend limits, logs and analytics. Each request is tagged with the site, feature, model and user, so the gateway's analytics answer "which feature is spending my neurons". If the gateway ever refuses a request, the plugin falls back to direct calls for an hour and tells you. Embeddings (beta) Turn the content you choose into vectors and keep them in a vector store, which the Site assistant, Related posts, the Link assistant, Member search and Search insights use. Off until you switch it on. The default model is BGE-M3 (multilingual, 1,024 dimensions). What the embeddings are used for Each tool is off until you switch it on, and each has a daily limit so one cannot use up what the others need. Editable prompts Every prompt the plugin sends on its own behalf is on the Prompts tab, with placeholders, reset to default, and a test button that shows the result and its cost. Developers keep the aipcf_prompt filter. The AI plugin (recommended) AIPCF is the engine. The WordPress AI plugin adds the block-editor features that use it: excerpts, titles, meta descriptions, alt text on upload, summaries, image generation. It is recommended, not required; AIPCF's own features (backfill, Embeddings and the content tools, usage tracking, daily budget, and aipcf_translate() for developers) work without it.

安装:

  1. Install and activate the plugin. You land on Cloudflare AI, a new item in the admin menu.
  2. Add your Cloudflare API token on Settings > Connectors (WordPress 7.0+ manages provider keys there) and your Account ID on the Overview tab. The setup panel has the exact clicks for creating the token.
  3. Click Apply recommended defaults. That picks the models, turns on the daily budget and caching, and approves the connector.
  4. Optional: install the WordPress AI plugin for AI in the block editor, and enter an AI Gateway name on the AI Gateway tab for edge caching and logs.
wp-config.php constants (optional) define( 'CLOUDFLARE_WORKERS_AI_ACCOUNT_ID', 'your-account-id' ); define( 'CLOUDFLARE_WORKERS_AI_API_TOKEN', 'your-api-token' ); define( 'CLOUDFLARE_WORKERS_AI_DEFAULT_MODEL', '@cf/google/gemma-4-26b-a4b-it' ); define( 'CLOUDFLARE_AI_GATEWAY_TOKEN', 'gateway-auth-token' ); // only for authenticated gateways define( 'AIPCF_QDRANT_API_KEY', 'qdrant-api-key' ); // Embeddings stored in Qdrant define( 'AIPCF_PG_PASSWORD', 'postgres-password' ); // Embeddings stored in PostgreSQL Settings saved on the page take precedence over the constants. Environment variables with the same names are also read.

屏幕截图:

  • Setup panel after activation: connect, apply the recommended defaults, and the recommended AI plugin.
  • Models: default model with cost and capability labels, light model for short tasks, image model.
  • Budget & cache: the daily budget, what happens when it is reached, and caching.
  • A neuron receipt in the block editor after generating a meta description.
  • Backfill: backlog, progress and controls.
  • Prompts: every plugin prompt, editable, with a test button.
  • Site Health showing the Cloudflare Workers AI test.

升级注意事项:

1.11.2 If the AI plugin (1.3.0) blocks this plugin, Site Health now says to approve it on Tools > Connector Approvals instead of blaming your token. 1.11.1 Fixes the Site assistant page: the usage bar now shows the day's use, and the description follows who can use the chat. 1.11.0 Adds the Site assistant: a chat for members, or every visitor, that answers from your own posts, with guardrails you can add to. Switching vector stores now copies the vectors (no neurons, no gap in related posts or search) and offers to delete what is left in the old store. 1.10.0 Adds Cloudflare AI > Activity: what people did in the plugin and what it did on its own, with every change Backfill made, and a CSV download. Administrators only; entries are kept 90 days by default. 1.9.0 Requires PHP 8.2+. Adds Embeddings (beta) in Vectorize, Qdrant or PostgreSQL, and on them Related posts, the Link assistant, Member search and Search insights. All off until switched on; existing features unchanged. 1.8.14 Fixes a crash when saving a customised prompt, plus backfill and budget fixes. The settings now show which model answers each kind of request (alt text uses a vision model, usually Llama 3.2 Vision), and Meta's licence for it can be accepted with one click. Settings are kept. 1.8.12 Big update from 1.0.3: new "Cloudflare AI" menu (old links redirect), newer models, neuron budget guard, AI Gateway, backfill, images, translation. Credentials and model choice are kept; recommended defaults are offered, nothing changes until you click.

常见问题:

Is it really free?

Cloudflare Workers AI includes 10,000 neurons a day on every account, with no card on file. Measured on a live site, a meta description costs about 2 neurons and an alt text about 17, so a normal site never gets near the limit. Above the allowance Cloudflare bills per neuron at its published rate; the plugin's daily budget is there so that does not happen by accident.

What happens when the daily budget is reached?

You choose: pause AI requests until midnight UTC, or switch text requests to the cheapest model on your account. Only text requests have a cheaper model: Backfill, Embeddings, Link assistant chat, the Site assistant, Member search, Search insights, image generation, image reading (alt text) and translation pause either way. Generated images count about 170 neurons each when Cloudflare does not report the figure. Either way you get an email at 80% and at 100%. The count resets at midnight UTC.

Which model should I use?

Start with the recommended defaults: Gemma 4 26B for writing and Granite 4 Micro for short tasks. They were picked by measuring output quality against neurons on real posts. Llama 3.3 70B writes a little better and costs several times more per token. The Models tab shows the neurons per 1,000 tokens for every model on your account, read from Cloudflare's price list.

I picked a model, but the logs show a different one (often Llama)

That is expected for some requests, and the Overview and Models tabs list the model for each one under "Current model setup". Writing uses your default model. Short tasks (titles, excerpts, meta descriptions, alt text wording) use the light model if you set one; a model you pick for a feature in the AI plugin is used as picked. Anything that reads an image, such as alt text, uses the vision model, because text models cannot see images; on most accounts that is Llama 3.2 11B Vision, and you can pick another vision model on the Models tab. Generated images use the image model, translation uses M2M100 or IndicTrans2, and once the daily budget is used up text requests can switch to the cheapest model. The AI Gateway logs show which feature sent each request in the metadata field.

Do I need the WordPress AI plugin?

Not for AIPCF's own features (backfill, Embeddings and the content tools, usage tracking, daily budget, and aipcf_translate() for developers). You need it for AI inside the block editor: excerpts, titles, meta descriptions, summaries, alt text on upload and image generation. Install it from wordpress.org; AIPCF registers itself as the provider.

Does it work with the Classic editor?

Backfill, Embeddings, the content tools and the budget do, and so does aipcf_translate(). The in-editor buttons come from the WordPress AI plugin and need the block editor.

Where does my content go?

To Cloudflare. When a feature runs, the post title and content (or the image) go to Cloudflare Workers AI on your own account. Nothing is sent until you enter your credentials, and the External Services section below lists every endpoint. With an AI Gateway you decide in the Cloudflare dashboard whether prompts are logged. If you switch Embeddings on, the content you selected is also stored, with its embeddings, in the vector store you chose: Cloudflare Vectorize on your account, your Qdrant server or Qdrant Cloud cluster, or your PostgreSQL database. Nothing else receives it. Embedding requests go through your AI Gateway (when you use one) with payload logging off, so the gateway's logs never hold a copy of your content. Author names are embedded only if you tick "Author name", and change in the vector store when a name changes or a user's posts are reassigned.

Where is my API token stored?

On WordPress 7.0+ it lives in the core Connectors screen (Settings > Connectors), like every other AI provider key. You can also define it as a constant in wp-config.php. The plugin never sends it anywhere except Cloudflare.

What are embeddings for?

An embedding is a list of numbers that captures what a piece of text is about, so text with a similar meaning gets similar numbers. Kept in a vector store, they let a site find posts by meaning instead of by keyword ("how much does it cost" finds the pricing page) and suggest truly related posts. AIPCF uses them for Related posts, the Link assistant, Member search and Search insights.

Which vector store should I choose?

Cloudflare Vectorize if you want nothing else to run: it uses the same Cloudflare account and token (add the permission Account > Vectorize > Edit), and the Workers Free plan stores about 4,900 passages at 1,024 dimensions, enough for a few hundred posts. Bigger sites need Workers Paid ($5 a month, 10 million stored dimensions included). Qdrant if you already run it or want Qdrant Cloud's free 1 GB cluster. PostgreSQL with pgvector if you have such a database; your host's PHP needs the pdo_pgsql extension, which many do not enable (the settings page tells you).

Can I switch to another vector store later?

Yes, without paying again. Pick the new store on the Embeddings tab (set up its connection first) and save: the vectors are copied from the old store, not embedded again, so it costs no neurons. Related posts and search keep using the old store until the move is done, and you can cancel it. Afterwards the Embeddings tab offers to delete what is left in the old store. Posts edited since they were embedded, and a change of embedding model, do need new embeddings. From WP-CLI: wp aipcf embed move qdrant.

How much does embedding cost?

With BGE-M3, about 1,070 neurons per million tokens. Cloudflare reports no usage for embeddings, so the plugin estimates it from text length and shows it with a "~". A typical blog post of 2,000 characters costs under 1 neuron; a 150-post blog about 60. The Embeddings tab estimates your site before you start, and Embeddings has a daily limit.

Can I stop embeddings, or remove the vectors?

Switch Embeddings off to stop sending anything. "Delete vectors" on the Embeddings tab switches it off and deletes this site's vectors from the vector store (the whole index when it is the site's own, only this site's entries when the index is shared). Resetting or deleting the plugin removes its own tables and settings but never deletes anything in the vector store, so use "Delete vectors" first if you want them gone.

Will the backfill overwrite descriptions or alt text I wrote?

No. It only fills empty fields. Posts that already have a meta description and images that already have alt text are never touched. It writes to the meta key of your SEO plugin (Yoast, Rank Math, AIOSEO or SEOPress), so you can edit the result where you always do.

Can I stop the backfill, or undo it?

Switch off Backfill ("Run hourly") on the Backfill tab and it stops after the current batch. Descriptions it wrote are ordinary post meta; edit or clear them like any other. The tab shows the last skipped item, with "Retry skipped items" to try skipped items again.

Does it slow my site down?

No. Requests only happen when a feature runs, and the backfill runs in the background through WP-Cron, one batch an hour. Visitors never wait on Cloudflare.

Can I use one Cloudflare account for several sites?

Yes, and many people do. Keep in mind the 10,000-neuron allowance is per Cloudflare account, not per site, so set each site's daily budget to a share of it. An AI Gateway shows the usage of all sites in one place.

Can I change what the plugin asks the model?

Yes. The Prompts tab holds every prompt the plugin sends on its own behalf, with placeholders and a test button. Developers can also use the aipcf_prompt filter.

A model says "Model Agreement: Prior to using this model, you must submit the prompt 'agree'"

This is Meta's license for its Llama models, not a license of this plugin. Cloudflare will not run some Meta models (Llama 3.2 Vision) on your account until Meta's Llama Community License and Acceptable Use Policy have been accepted once, and Cloudflare keeps the record of that acceptance. AIPCF has no license of its own to accept: it shows a notice with Meta's terms and an "Accept Meta's license and send it to Cloudflare" button, which sends it with your own token. A curl command is included if you prefer to send it yourself.

I get "connector has not been approved"

WordPress asks administrators to allow each AI connector once. "Apply recommended defaults" does it for you; otherwise go to Tools > Connector Approvals and allow Cloudflare Workers AI there.

Requests time out

The plugin waits up to 60 seconds. 70B-class and reasoning models can take longer on a cold start. Raise the limit with the aipcf_request_timeout filter or pick a smaller model.

Reasoning models return an empty answer

Qwen3, GLM and GPT-OSS spend tokens thinking before they answer. The plugin turns thinking off by default where the model allows it and applies a 2,048-token output limit when the caller sets none. If you still see empty answers, raise max_tokens or pick a non-reasoning model.

How do I start over, or remove everything?

"Reset plugin" at the foot of the About card deletes the plugin's settings, including the credentials saved in them, your prompt edits, usage history, backfill progress, caches, embeddings tracking, the Link assistant's data, logged searches and the "What to write next" analysis, and the Related lists. It keeps what the plugin wrote into your posts (meta descriptions, alt text), the posts you left out of Embeddings and the images you marked decorative. Credentials set in wp-config.php or environment variables are not touched. Reset does not touch the vector store: vectors already there stay, and "Delete vectors" on the Embeddings tab deletes them. Use it before Reset if you want them gone. Deleting the plugin from the Plugins screen does the same cleanup and also removes the Embeddings exclusions and decorative marks, on every site of a network. The API token on Settings > Connectors is WordPress's own setting: remove it there.

Do Related posts, Member search or Search insights cost anything?

Related posts: no neurons (lists come from stored vectors); one vector store query per post when its list is built. Member search: about 0.03 neurons per search, one vector store query, cached for an hour. Search insights: about 0.03 neurons per distinct search compared, and one request to your default model when you ask "What to write next". The Link assistant's suggestions are free; each chat message is one short request to your light model. Each tool has a daily limit in Cloudflare AI > Settings > Content tools. On the Vectorize free plan (30 million queried dimensions a month, about 29,000 queries), Site Health warns when the month's queries are heading past it.

What does the Site assistant cost, and what does it store?

Each question is one search (about 0.03 neurons) and one answer from your default text model, typically 10 to 30 neurons; the optional safety check adds a small Llama Guard request per question and per answer. It has its own daily limit on the Budget tab, and visitors (if you let them in) get only a share of it and a number of questions each per day. Chats are stored in your database only when the person ticks "save this chat": their name (no email), the questions, the answers and the posts cited. Administrators see them under Cloudflare AI > Site assistant, with a CSV download. They are deleted after 90 days (adjustable), are covered by WordPress's personal data export and erase tools, and the suggested privacy-policy text describes them. Visitors' IP addresses are never stored: the daily count uses a one-way key that changes every day.

Who can see Search insights, and what is stored?

Administrators, under Cloudflare AI > Search insights. For each search: the text, when, how many results, the best match and whether the searcher was logged in. No user account, IP address or browser details. Bots are skipped, a repeat by the same visitor within an hour counts once, rows are capped each day, and searches are deleted after 90 days (adjustable). Off by default; the suggested privacy-policy text covers it.

Can I go back to an earlier version?

Yes; settings and usage history carry over both ways. Versions before 1.9.0 do not know about Embeddings, so they do not follow edits meanwhile; when 1.9.0 or later is back, it checks every item again and catches up (unchanged content costs nothing). The same happens after the plugin has been deactivated. Deleting the plugin while an earlier version is installed leaves the data added in 1.9.0 behind (tables, options and post meta for Embeddings and the Content tools). The same goes for the activity log added in 1.10.0 and the saved chats added in 1.11.0. Reinstall the latest version and delete it again to remove everything.

How do I use it from my own code?

Any feature or plugin built on the WordPress AI Client uses Cloudflare Workers AI once the plugin is configured. Direct calls: use WordPress\AiClient\AiClient; // Uses the model chosen in Settings. $result = AiClient::prompt( 'Summarize this post in two sentences.' ) ->usingProvider( 'cloudflare-workers-ai' ) ->generateTextResult(); echo $result->toText(); // A specific model: $model = AiClient::defaultRegistry()->getProviderModel( 'cloudflare-workers-ai', '@cf/qwen/qwen2.5-coder-32b-instruct' ); $result = AiClient::prompt( 'Write a PHP function that slugifies a string.' )->usingModel( $model )->generateTextResult(); // Translation: echo aipcf_translate( 'Good morning', 'mr' ); // Marathi via IndicTrans2 echo aipcf_translate( 'Bonjour', 'en', 'fr' ); // any pair via M2M100 Structured output and tools use the standard AI Client API: ->asJsonResponse( $schema ) and ->usingFunctionDeclarations( ... ).

Which WP-CLI commands are there?

wp aipcf embed status [--store] # embedded, waiting, failed; the vector store's own count wp aipcf embed estimate # passages, tokens, neurons and storage for the selection wp aipcf embed run --until-done # embed everything now (large sites); resumable wp aipcf embed search "query" # test a search wp aipcf embed reconcile | retry | rebuild | purge wp aipcf embed move [--index=] # copy the vectors to another store, no neurons wp aipcf embed move --status | --cancel wp aipcf embed cleanup-old # delete what a move left in the old store run, reconcile and rebuild refuse to work while Embeddings are switched off. wp aipcf related refresh [--all] # build related lists now wp aipcf related show 123 # a post's list with scores wp aipcf activity list [--tool=backfill] [--failed] # recent entries wp aipcf activity export --file=activity.csv # the same CSV as Download CSV

Which shortcodes are there?

[aipcf_related count="5" title="Related posts" heading="h2" excerpt="no" thumbnail="no"] [aipcf_search placeholder="Search by meaning" results="10"] count is 1 to 12 (default: the Content tools setting, 5), heading is h2, h3, h4 or p, and only posts at least as similar as the "Minimum similarity" setting (default 0.55, a 55% match) are listed. results is 1 to 20. Related posts outputs a <nav class="aipcf-related"> list and Member search a <form class="aipcf-search"> with an <ol class="aipcf-search__list">; both take the theme's styles.

Which filters are there?

  • aipcf_prompt( $text, $key, $vars ): final say on any plugin-owned prompt.
  • aipcf_route_text_model( $model, $requested, $task ): override which model serves a request.
  • aipcf_available_models( $models ): adjust the model list before it is cached.
  • aipcf_request_timeout( $seconds, $model ), aipcf_default_max_tokens, aipcf_disable_thinking, aipcf_system_instruction_suffix.
  • aipcf_gateway_headers( $headers, $task, $model ), aipcf_gateway_metadata, aipcf_gateway_enabled.
  • aipcf_over_budget, aipcf_cheapest_model, aipcf_local_cache_ttl, aipcf_regenerate_window.
  • aipcf_backfill_meta_description_key, aipcf_backfill_alt_prompt, aipcf_vision_model.
  • aipcf_image_neurons_estimate( $neurons, $model ), aipcf_translation_neurons_per_1k( $rate, $model ): what to count when Cloudflare reports no neurons; aipcf_vision_byte_array_max( $bytes ).
  • Embeddings: aipcf_embed_should_index( $bool, $post ), aipcf_embed_text( $text, $post ), aipcf_embed_metadata( $metadata, $post ), aipcf_embed_post_types( $types ), aipcf_embed_locale( $locale, $post ), aipcf_embedding_models( $models ), aipcf_vector_store( $store, $id, $index ) (supply your own store), aipcf_vectorize_token( $token ).
Actions: aipcf_usage_recorded, aipcf_cache_hit, aipcf_gateway_marked_down, aipcf_backfill_meta_description, aipcf_backfill_alt_text, aipcf_defaults_applied, aipcf_model_licence_accepted( $model, $owner ) (after Cloudflare confirms your acceptance of a model publisher's license, such as Meta's). REST (users who can edit posts): GET /wp-json/aipcf/v1/last (last request's receipt), GET /wp-json/aipcf/v1/usage (today's totals).

Does this work without WordPress 7.0?

No. The AI Client arrives in WordPress 7.0; the plugin does nothing on older versions.

更新日志:

1.11.2 1.11.1 1.11.0 1.10.0 1.9.0 1.8.14 1.8.13 1.8.12 The first update since 1.0.3. If you are coming from 1.0.3, this is what changed: 1.7.8 1.6.0 1.5.0 1.4.8 1.3.0 1.2.0 1.1.2 1.0.0