AI with your own key
Ask Claude, ChatGPT or another model to change the open file, fill in starters and tailor new themes, using your own API key.
Temper's built-in AI uses your own API key from Anthropic or any OpenAI-compatible service. It works in Temper and Temper Pro, with no limits from us; your provider bills you for what you use.
It can:
- Change the open file from an instruction, in the editor's AI tab. You review the change as a diff before anything is applied.
- Fill in a starter from a description, when you create a block, pattern or post type.
- Tailor a new blank block theme or plugin starter from a description of the site.
The AI never writes files by itself. What it proposes still passes the save checks, and a starter whose AI version fails them is created from the plain template instead.
To let an assistant such as Claude Code or Cursor work across the whole project, see AI assistants over MCP. Pro
Add your key#
- Go to Temper › Settings and open the AI tab.
- Choose the Provider:
- Anthropic (Claude)
- OpenAI or compatible
- Set the Model. For Anthropic the default is
claude-opus-5-5;claude-sonnet-5-5is faster and cheaper. For other providers, enter the exact model id your provider uses. - For OpenAI or compatible, set the API base URL. It's
https://api.openai.com/v1by default; change it for OpenRouter, Groq or another OpenAI-compatible service. - Paste your API key and click Save.
The key is encrypted in the database and never sent to the browser. Once saved, the field says "Saved. Enter a new key to replace it." Click Remove key to delete it.
Changing the provider or the base URL to a different server removes the saved key, unless you enter a new one in the same save, so a key is never sent somewhere new. Temper doesn't call local, private or reserved addresses. To use a model on your own machine or network, such as Ollama, define TEMPER_AI_ALLOW_PRIVATE in wp-config.php.
Change the open file#
- Open the file and click the AI tab in the side panel.
- Describe the change, such as "add a search field to the header".
- Click Ask, or press ⌘Enter or Ctrl+Enter.
The button shows progress while the answer arrives, such as "Writing line 120 of about 300…". Then the editor shows AI suggestion with a one-line summary, and the proposed changes in the file:
- Use the buttons on each change to keep or reject it.
- Click Apply to file to put the result in the editor, or Discard to drop it.
Applying doesn't save. Review the file, then save with ⌘S or Ctrl+S, and the save checks run as usual. If the AI suggests no changes, it says why.
The AI works on the file as it is in the editor, unsaved edits included, and returns the whole file.
What's sent to the provider#
Requests go from your server to the provider you chose, never from your browser. Each request holds:
- Instructions for the model: follow WordPress coding standards, escape output, prefer
theme.jsonpresets, keep block markup valid. - A short description of the project. For a theme: its name, slug, whether it's a block or classic theme, its parent, the WordPress version, and the names of its color, font size and spacing presets. For a plugin: its name, slug, main file, the WordPress version, and the active theme's name and type. Whether Advanced Custom Fields (and, for plugins, Elementor) is active.
- For Ask: the open file's path and content, and your instruction.
- For starters and new projects: the generated starter files and your description.
Limits and errors#
- One answer can be up to 32,000 tokens with Anthropic. A very large file can be cut off: "The response was cut off. Try a smaller file or a narrower instruction."
- Requests wait up to 5 minutes.
- With PHP's cURL extension, answers stream in as they're written. That keeps the connection busy, so nginx, a proxy or a CDN in front of the site doesn't close it as idle. Without cURL, requests are made in one piece.
- With OpenAI or compatible, Temper asks for a JSON answer. Use a model that supports JSON output.
See Troubleshooting for the error messages.