AI service

Anthropic

The Anthropic integration connects your project to the Anthropic (Claude) API — with a shared, Dreambase-managed key or a dedicated key you provide — exposes the connection details as outputs, and offers messages, token counting, and model listing via function calls, plus health checks and metrics.

Anthropic is one of the AI service integrations. It handles its own webhook route:

POST/anthropic/webhook
Connect to the Anthropic API (shared or dedicated)

What it does

On DEPLOYMENT_CREATED the service resolves the key (shared or dedicated), verifies it against the Anthropic /v1/models endpoint, and publishes the connection details — apiKey, models, and apiUrl — back to Dreambase as outputs for other services to consume. The deployment connects to the provider API; there is no infrastructure to provision.

Instance type

  • shared (default) — use the Dreambase-managed Anthropic key (ANTHROPIC_SHARED_API_KEY). Ideal for MVPs and development, with no setup required.
  • dedicated — bring your own Anthropic API key.

Choosing models

The models input is a comma-separated list of the model IDs you want to work with (e.g. claude-opus-4-8, claude-sonnet-5, claude-haiku-4-5). The first one is used as the default when a function call doesn't name a model. Configured models that the key can't see are logged as a warning at configure time, but don't fail the connection.

Inputs

InputApplies toDescription
serverTypeallEither shared (default) or dedicated.
apiKeydedicatedYour Anthropic API key. Accepts a {{env.KEY}} reference.
baseUrlallOptional. Target an Anthropic-compatible gateway (default https://api.anthropic.com).
modelsallComma-separated model IDs to work with. The first is the default.

Outputs

  • apiKey — the resolved Anthropic API key.
  • models — the comma-separated list of configured model IDs.
  • apiUrl — the base URL used for API requests.

Functions

Callable via a FUNCTION_CALL event:

  • listModels — list the model IDs available to the key.
  • createMessage — generate a message. Provide either a full messages array or a simple prompt (with an optional system prompt), plus optional model, maxTokens (default 1024), and temperature. Returns the concatenated text content, model, stopReason, and usage.
  • countTokens — count the input tokens a message would use, without generating a response. Returns inputTokens.

Metrics

On METRIC_UPDATE the service reports available_models (the number of models the key can access) and configured_models (the number selected for this service).

API version header

Requests are sent with the anthropic-version: 2023-06-01 header and authenticated with the x-api-key header, per the Anthropic API.

Events it handles

  • WEBHOOK_CHALLENGE — verify the webhook endpoint.
  • HEALTH_CHECK — probe the Anthropic /v1/models endpoint with the configured key.
  • METRIC_UPDATE — report available and configured model counts.
  • DEPLOYMENT_CREATED — verify the key and publish the connection details as outputs.
  • DEPLOYMENT_DELETED — stop tracking the connection (nothing external is torn down).
  • FUNCTION_CALL — run a named function.