Skip to content

Conversation

@udit-329
Copy link

@udit-329 udit-329 commented Nov 27, 2025

What it does

Adds support for custom anthropic models. This works similar to how user can configure custom openAI models for situations such as when the model is hosted on a custom url.

Addresses #16666

How to test

If a user has an Anthropic model that is accessed from a custom endpoint, they can add it in settings.json similar to how it can already be done for openAI models.

"ai-features.AnthropicCustom.customAnthropicModels": [
        {
            "model": "claude-sonnet-4",
            "url": "<custom-url>",
            "id": "<model-ID>",
            "apiKey": "<API-Key>"
        }
    ]

Follow-ups

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

@github-project-automation github-project-automation bot moved this to Waiting on reviewers in PR Backlog Nov 27, 2025
@ndoschek ndoschek requested a review from sdirix December 2, 2025 14:22
@ndoschek ndoschek linked an issue Dec 5, 2025 that may be closed by this pull request
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution ❤️

I tested it successfully by defining a custom model against the official API endpoint 👍

However there is an issue with the "apiKey"-less path, see my comments.

@@ -1,5 +1,5 @@
// *****************************************************************************
// Copyright (C) 2024 EclipseSource GmbH.
// Copyright (C) 2024, 2025 EclipseSource GmbH.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't update the year in the Theia project and just leave the header alone once a file is created.


export const API_KEY_PREF = 'ai-features.anthropic.AnthropicApiKey';
export const MODELS_PREF = 'ai-features.anthropic.AnthropicModels';
export const CUSTOM_ENDPOINTS_PREF = 'ai-features.AnthropicCustom.customAnthropicModels';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const CUSTOM_ENDPOINTS_PREF = 'ai-features.AnthropicCustom.customAnthropicModels';
export const CUSTOM_ENDPOINTS_PREF = 'ai-features.anthropicCustom.customAnthropicModels';

[CUSTOM_ENDPOINTS_PREF]: {
type: 'array',
title: AI_CORE_PREFERENCES_TITLE,
markdownDescription: nls.localize('theia/ai/anthropic/useResponseApi/mdDescription',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
markdownDescription: nls.localize('theia/ai/anthropic/useResponseApi/mdDescription',
markdownDescription: nls.localize('theia/ai/anthropic/customEndpoints/mdDescription',

Comment on lines +122 to +125
// Always mark custom models (models with url) as ready for now as we do not know about API Key requirements
if (modelDescription.url) {
return { status: 'ready' };
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not sufficient. Within the AnthropicModel we check for the api key and if it does not exist, the model will immediately throw an error before even trying to use the SDK, see here.
If we allow apiKey-less models to report ready, then there must be a successful path for them.

Please check what is required for this. In the OpenAI SDK we always need to hand over a key, so for keyless models we hand over a "stub key". I don't know whether this is also required for the Anthropic SDK or whether it actually supports not handing over a key if the endpoint does not need one.

@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Waiting on author in PR Backlog Dec 9, 2025
@ndoschek
Copy link
Member

Hi @udit-329, just a gentle ping, the review is done and there are a few points that would need your input before we can proceed. TIA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on author

Development

Successfully merging this pull request may close these issues.

add support for custom hosted Anthropic models

3 participants