Skip to main content
AI Puffer exposes REST endpoints under the WordPress REST API. Use the API when an external application needs to generate text, generate images, create embeddings, send a message to a chatbot, read chat logs, or add content to a vector store. Base URL:
https://your-site.com/wp-json/aipkit/v1

Authentication

Most endpoints require the AI Puffer REST API key.
  1. Open WordPress Admin > AI Puffer > Settings.
  2. Open Developers.
  3. Enter a value in REST API Key.
  4. Wait for the setting to save.
Developer Settings with the REST API Key field
Leaving the field blank disables REST API access. Treat the key like a password. Anyone with the key can call the enabled REST endpoints from outside WordPress.

Send the key in a header

Use an Authorization header when possible.
curl https://your-site.com/wp-json/aipkit/v1/logs \
  -H "Authorization: Bearer YOUR_API_KEY"

Send the key as a request parameter

You can also send the key as aipkit_api_key.
curl https://your-site.com/wp-json/aipkit/v1/logs?aipkit_api_key=YOUR_API_KEY

Endpoints

EndpointMethodUse
/generatePOSTGenerate text with a configured AI provider.
/images/generatePOSTGenerate images.
/embeddingsPOSTCreate embeddings from text.
/chat/{bot_id}/messagePOSTSend a message to a chatbot.
/logsGETRead saved chat logs.
/vector-stores/upsertPOSTEmbed text and upsert it into Pinecone or Qdrant.
/chatbots/{bot_id}/embed-configGETRead the embed config and HTML for an external chatbot widget.

Text generation

Generate a text response with one of the configured text providers.
POST /wp-json/aipkit/v1/generate

Parameters

ParameterTypeRequiredNotes
providerstringYesopenai, azure, google, openrouter, claude, deepseek, or ollama.
modelstringYesModel ID or Azure deployment ID.
messagesarrayYesChat-style messages with role and content. Roles: system, user, assistant.
system_instructionstringNoExtra instruction text. Supports [date] and [username].
ai_paramsobjectNoOverrides for AI parameters such as temperature or max_completion_tokens.
streambooleanNoThis endpoint does not support streaming. Leave it as false.

Request

curl -X POST https://your-site.com/wp-json/aipkit/v1/generate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "provider": "openai",
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "user",
        "content": "Write a two sentence product description for a handmade ceramic mug."
      }
    ],
    "ai_params": {
      "temperature": 0.7
    }
  }'

Response

{
  "content": "A handmade ceramic mug with a simple shape and a smooth glazed finish. Suitable for coffee, tea, or daily desk use.",
  "usage": {
    "input_tokens": 18,
    "output_tokens": 25,
    "total_tokens": 43
  },
  "provider": "OpenAI",
  "model": "gpt-4o-mini"
}

Image generation

Generate images from a text prompt.
POST /wp-json/aipkit/v1/images/generate

Parameters

ParameterTypeRequiredNotes
promptstringYesText prompt for the image.
providerstringNoopenai, azure, or google. Default: openai.
modelstringNoImage model ID. Uses plugin settings if omitted.
nintegerNoNumber of images. Minimum 1, maximum 10. Default: 1.
sizestringNoSupported values include 1024x1024, 1792x1024, 1024x1792, 1536x1024, 1024x1536, 1024x768, and 768x1024.
qualitystringNostandard or hd, when supported by the selected model.
stylestringNovivid or natural, when supported by the selected model.
response_formatstringNourl or b64_json. Default: url.

Request

curl -X POST https://your-site.com/wp-json/aipkit/v1/images/generate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "provider": "openai",
    "model": "gpt-image-1",
    "prompt": "A clean product photo of a handmade ceramic mug on a white table",
    "n": 1,
    "size": "1024x1024",
    "response_format": "url"
  }'

Response

{
  "images": [
    {
      "url": "https://example.com/generated-image.png",
      "b64_json": null,
      "revised_prompt": null
    }
  ],
  "usage": null,
  "message": "1 image generated successfully."
}

Embeddings

Create embeddings from one string or an array of strings.
POST /wp-json/aipkit/v1/embeddings

Parameters

ParameterTypeRequiredNotes
providerstringYesopenai, google, azure, or openrouter.
modelstringYesEmbedding model ID or Azure deployment ID.
inputstring or arrayYesText to embed.
dimensionsintegerNoOpenAI, OpenRouter, or Azure output dimensions when supported.
encoding_formatstringNoOpenAI or OpenRouter format: float or base64. Default: float.
task_typestringNoGoogle embedding task type.
output_dimensionalityintegerNoGoogle embedding output dimension size.
userstringNoEnd-user identifier for OpenAI or Azure monitoring.
Google task_type values:
SEMANTIC_SIMILARITY
CLASSIFICATION
CLUSTERING
RETRIEVAL_DOCUMENT
RETRIEVAL_QUERY
QUESTION_ANSWERING
FACT_VERIFICATION
CODE_RETRIEVAL_QUERY

Request

curl -X POST https://your-site.com/wp-json/aipkit/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "provider": "openai",
    "model": "text-embedding-3-small",
    "input": "AI Puffer is a WordPress plugin."
  }'

Response

{
  "embeddings": [
    [-0.0069, -0.0053, 0.0124]
  ],
  "usage": {
    "input_tokens": 8,
    "total_tokens": 8
  },
  "provider": "OpenAI",
  "model": "text-embedding-3-small"
}

Chat message

Send a message to one chatbot. The chatbot must exist in WordPress. The request uses the chatbot settings saved in AI Puffer.
POST /wp-json/aipkit/v1/chat/{bot_id}/message

Parameters

ParameterTypeRequiredNotes
bot_idintegerYesChatbot ID in the URL.
messagesarrayYesConversation history. Roles: user and assistant. The last message must be from user.

Request

curl -X POST https://your-site.com/wp-json/aipkit/v1/chat/123/message \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "messages": [
      {
        "role": "user",
        "content": "What can you help with?"
      }
    ]
  }'

Response

{
  "reply": "I can answer questions using the chatbot settings configured in WordPress.",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 13,
    "total_tokens": 28
  },
  "bot_id": 123,
  "model": "gpt-4o-mini"
}

Chat logs

Read saved chatbot conversation logs.
GET /wp-json/aipkit/v1/logs

Parameters

ParameterTypeRequiredNotes
pageintegerNoPage number. Default: 1.
per_pageintegerNoLogs per page. Default: 20, maximum: 100.
bot_idintegerNoFilter by chatbot ID.
user_searchstringNoSearch display name, username, or email.
message_searchstringNoSearch conversation content.
The response includes pagination headers:
HeaderMeaning
X-WP-TotalTotal matching logs.
X-WP-TotalPagesTotal pages.

Request

curl "https://your-site.com/wp-json/aipkit/v1/logs?per_page=10&bot_id=123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

[
  {
    "id": "1",
    "bot_id": "123",
    "user_id": "1",
    "session_id": null,
    "conversation_uuid": "e8a3c-b3a1-4f9e",
    "messages": "[...]",
    "message_count": "4",
    "last_message_ts": "1724081015",
    "created_at": "2026-04-25 10:00:00",
    "bot_name": "Support Bot",
    "user_display_name": "admin"
  }
]

Vector store upsert

Embed text and add the vectors to Pinecone or Qdrant. The target index or collection must already exist. AI Puffer creates embeddings, then sends vectors to the selected vector database.
POST /wp-json/aipkit/v1/vector-stores/upsert

Parameters

ParameterTypeRequiredNotes
providerstringYespinecone or qdrant.
target_idstringYesPinecone index name or Qdrant collection name.
vectorsarrayYesObjects with content. Optional id and metadata.
embedding_providerstringYesopenai, google, azure, or openrouter.
embedding_modelstringYesEmbedding model ID or Azure deployment ID.
namespacestringNoPinecone namespace. Ignored by Qdrant.
Each vectors item must include:
FieldTypeRequiredNotes
contentstringYesText to embed and store.
idstringNoVector ID. AI Puffer generates one if omitted.
metadataobjectNoExtra metadata. AI Puffer also stores the original content in metadata.

Request

curl -X POST https://your-site.com/wp-json/aipkit/v1/vector-stores/upsert \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "provider": "pinecone",
    "target_id": "site-knowledge",
    "embedding_provider": "openai",
    "embedding_model": "text-embedding-3-small",
    "namespace": "docs",
    "vectors": [
      {
        "id": "intro",
        "content": "AI Puffer adds AI tools to WordPress.",
        "metadata": {
          "source": "manual"
        }
      }
    ]
  }'

Response

{
  "upserted_count": 1,
  "status": "success"
}

Chatbot embed config

Read the config and rendered HTML for an externally embedded chatbot. This endpoint is not authenticated with the REST API key. Access is controlled by the chatbot’s embed settings and allowed domains.
GET /wp-json/aipkit/v1/chatbots/{bot_id}/embed-config

Parameters

ParameterTypeRequiredNotes
bot_idintegerYesChatbot ID in the URL.

Response

{
  "config": {
    "botId": 123,
    "assetUrls": {
      "css": "https://your-site.com/wp-content/plugins/.../public-main.bundle.css",
      "mainJs": "https://your-site.com/wp-content/plugins/.../public-main.bundle.js"
    }
  },
  "html": "<div class=\"aipkit_chatbot\">...</div>"
}
If the request origin is not allowed, the endpoint returns 403.

Error format

Errors use the standard WordPress REST error format.
{
  "code": "rest_aipkit_invalid_api_key",
  "message": "Invalid or missing API Key.",
  "data": {
    "status": 401
  }
}