Skip to content

SDK drift: Python Metaculus uses api_token credential param; TypeScript uses apiKey #465

@realfishsam

Description

@realfishsam

Drift

Metaculus exchange constructor uses different credential parameter names in each SDK for the same bearer-token concept. Python uses api_token; TypeScript uses the shared apiKey field from ExchangeOptions.

TypeScript SDK

sdks/typescript/pmxt/client.ts, line 2574 — Metaculus constructor accepts the standard ExchangeOptions interface which provides apiKey:

// sdks/typescript/pmxt/client.ts line 2574
export class Metaculus extends Exchange {
    constructor(options: ExchangeOptions = {}) {
        super({ ...options, exchange: 'metaculus' });
    }
}

ExchangeOptions.apiKey (models.ts line 169) is the field through which an API key credential is passed to all exchanges.

Python SDK

sdks/python/pmxt/_exchanges.py, lines 309–320 — Metaculus constructor accepts a dedicated api_token parameter instead:

# sdks/python/pmxt/_exchanges.py lines 309–320
class Metaculus(Exchange):
    def __init__(
        self,
        api_token: Optional[str] = None,
        pmxt_api_key: Optional[str] = None,
        base_url: Optional[str] = None,
        **kwargs,
    ):
        super().__init__(
            exchange="metaculus",
            api_token=api_token,
            ...
        )

Exchange.__init__ then maps api_token into _get_credentials_dict and sends it to the sidecar as apiToken (client.py line 263).

Expected

Both SDKs should use the same credential parameter name for Metaculus. If Metaculus requires a bearer token semantically distinct from a generic API key, both SDKs should expose the same parameter name (e.g., both api_token / apiToken, or both api_key / apiKey). The sidecar field name sent over the wire should also be consistent.

Impact

Users migrating between SDKs or reading cross-SDK docs will pass api_key in Python (following the TypeScript pattern) and receive no authentication error — the credential will be silently dropped and requests will fail or be unauthenticated.

Found by automated SDK cross-language drift audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdk-driftCross-language SDK consistency findings (TypeScript vs Python)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions