Skip to content

[WIP] Add platform support feature for Python#768

Open
Copilot wants to merge 3 commits intomultilingualfrom
copilot/add-platform-support-python
Open

[WIP] Add platform support feature for Python#768
Copilot wants to merge 3 commits intomultilingualfrom
copilot/add-platform-support-python

Conversation

Copy link

Copilot AI commented Jan 22, 2026

  • Understand the blueprint specification in blueprint/api/platform.md
  • Analyze existing provider implementations (OpenAI, Anthropic)
  • Understand the AnyLLM base class and provider patterns
  • Create py/src/any_llm/providers/platform.py with:
    • Platform key parsing (ANY.v1.kid.fingerprint-base64key format)
    • Key loading and public key derivation
    • Sealed box decryption with X25519 + XChaCha20-Poly1305
    • Challenge-response authentication flow
    • Token caching and management
    • Provider key retrieval and decryption
    • PlatformProvider class that wraps other providers
    • Usage tracking for API calls
  • Register platform provider in py/src/any_llm/providers/__init__.py
  • Add unit tests for platform provider (19 tests passing)
  • Run linting and tests to verify implementation
  • Run code review and address feedback:
    • Fixed minimum sealed box size check (48 bytes instead of 32)
    • Added descriptive error messages
    • Moved inline imports to top of file
  • Run security scanning (CodeQL - 0 alerts)
Original prompt

This section details on the original issue you should resolve

<issue_title>[Generation]: Platform support in Python</issue_title>
<issue_description>Implement the feature described in blueprint/platform.md for Python.

Put the output in py/providers/platform.py.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 22, 2026 09:55
Co-authored-by: daavoo <12677733+daavoo@users.noreply.github.com>
Co-authored-by: daavoo <12677733+daavoo@users.noreply.github.com>
Copy link
Contributor

@daavoo daavoo left a comment

Choose a reason for hiding this comment

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

@tbille for me the biggest miss is that the base AnyLLM.create was not updated to match how we do it in the original implementation:

if api_key:
try:
# Validate if the key conforms with the any-api format.
# If it does, any-llm must ask any-api for the corresponding provider key.
PlatformKey(api_key=api_key)
# Import and instantiate PlatformProvider in-place to avoid circular dependency issues.
platform_class_name = "PlatformProvider"
platform_module_path = "any_llm.providers.platform"
try:
platform_module = importlib.import_module(platform_module_path)
except ImportError as e:
msg = f"Could not import module {module_path}: {e!s}. Please ensure the provider is supported by doing AnyLLM.get_supported_providers()"
raise ImportError(msg) from e
platform_class: type[AnyLLM] = getattr(platform_module, platform_class_name)
# Instantiate the class first and pass the provider next,
# so we don't change the common API between different provideers.
platform_provider = platform_class(api_key=api_key, api_base=api_base, **kwargs)
platform_provider.provider = provider_class # type: ignore[attr-defined]
except ValueError:
pass
else:
return platform_provider

@tbille
Copy link
Contributor

tbille commented Jan 28, 2026

@daavoo can you add the blueprint for the platform provider in this PR?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants