Anthropic Claude API provider

From MoodleDocs

New feature
in Moodle 5.3!

The Anthropic Claude API provider allows you to use Anthropic's Claude models to power Moodle's AI capabilities, such as generating, summarising, and explaining text. Image generation is not supported by the Claude API.

Requirements

You need an Anthropic account with access to a paid API key. See the Anthropic Console for account and billing information.

Anthropic Claude provider instance set-up

To create a provider instance:

  1. Go to Site administration > General > AI providers.
  2. Click 'Create a new provider instance'.
  3. Select Anthropic Claude API provider as AI provider plugin, enter a name for this instance, and enter your Anthropic API key.
  4. If required, set a site-wide rate limit and/or a user rate limit.
  5. Click 'Create instance'.
Creating an Anthropic Claude API provider instance, showing the name and API key fields.

To configure the Anthropic Claude provider instance:

  1. Go to Site administration > General > AI providers.
  2. Click the settings link for Anthropic Claude.
  3. Enable/disable actions as required.

For each action, you can customise the model's behaviour via the settings link.

Generate text, Summarise text and Explain text

  1. Select the AI model from the preset dropdown list, or choose Custom to enter the name of a model not in the list.
  2. The API endpoint field is pre-filled automatically. Leave this unchanged unless you are using a custom endpoint.
  3. Review and amend the system instruction as necessary.
  4. Enter values for the following settings as required and save changes.
  • max_tokens - The maximum number of tokens used in the generated text.
  • temperature - Controls the randomness of the generated text. Not available for all models.
Generate text action settings for the Anthropic Claude API provider, showing the model dropdown and system instruction fields.

To enable the Anthropic Claude provider instance:

  1. Go to Site administration > General > AI providers.
  2. Click the toggle to enable the instance.