AELDER

Connect the Anthropic SDK

Configure the Python Messages client with the service root URL and your own API key.

AELDER · SERVICE BASE URL
https://aelder.dev/v1

LOCAL CONFIGURATION

Let my agent set this up

Copy this task to an agent already running on your computer. Enter your API key locally when asked.

SETUP PROMPT
Help me connect Anthropic SDK to AELDER using this guide: https://aelder.dev/docs/anthropic-sdk/
Service Base URL: https://aelder.dev/v1
First inspect my installed version, active profile and configuration. Explain any mismatch with the guide before changing anything.
Use the documented local configuration or CLI method. Do not automate the GUI, install software or change permissions without asking.
Preserve existing accounts, providers, models, defaults, permissions and unrelated settings. Propose the smallest change, show a redacted diff, and back up any files before editing.
Have me enter my API key locally using the tool's secret storage or an environment variable. Never ask me to paste a key into chat, print it, or include it in a command, diff, log or commit.
Use the exact model ID I choose from my account's model list. Do not invent model IDs or assume every model supports every API format or tool feature.
Validate syntax and configuration loading before making any generation request. If there is no dry-run, say so.
Explain any proposed paid test, the model and what it sends, and ask for approval before running it. Do not send project files or private conversation history as a test.
Finish with the settings changed, checks performed and steps to restore the backup.

Use this route for a text model that supports Anthropic Messages. It calls /v1/messages, not Chat Completions. This is a compatible API connection, independent of an Anthropic account or subscription.

1. Prepare the environment

Install anthropic in your project’s Python environment:

python -m pip install anthropic

Set SERVICE_BASE_URL to the service Base URL above, including /v1, and SERVICE_MODEL_ID to an exact Messages-compatible ID from your model list. Provide SERVICE_API_KEY locally through your environment or secrets manager. Keep it out of source control and chat.

2. Configure the client

The SDK needs the API root. This code removes the final /v1 because the Messages client adds /v1/messages itself:

import os
from anthropic import Anthropic

base = os.environ["SERVICE_BASE_URL"].rstrip("/")
root = base[:-3] if base.endswith("/v1") else base
client = Anthropic(
    base_url=root,
    api_key=os.environ["SERVICE_API_KEY"],
    max_retries=0,
)
message = client.messages.create(
    model=os.environ["SERVICE_MODEL_ID"],
    max_tokens=256,
    messages=[{"role": "user", "content": "Reply with OK."}],
)
for block in message.content:
    if block.type == "text":
        print(block.text)

Running the example sends a billable request. The SDK supplies authentication and its API version header. Enter the key itself, without Bearer.

3. Verify and switch models

Check the model and usage in your service dashboard. Change SERVICE_MODEL_ID to another exact Messages-compatible ID for a different model. Use the authenticated models endpoint to obtain IDs; the SDK’s original model catalog is not the service’s catalog.

A URL error containing /v1/v1/messages means the SDK received a base URL with an extra /v1. A model error may mean the chosen model does not support Messages. Thinking, prompt-cache controls, server tools, file upload, batches and token counting require separate endpoint or model support; this guide establishes a text configuration only.

Sources: Anthropic’s Python SDK configuration and SDK source.

Need the key? Open your AELDER dashboard. For direct API calls, see the API reference.