Skip to main content

langchain-apertis

Native LangChain integration for the Apertis AI API. It uses the official apertis SDK directly and does not depend on langchain-openai.

Installation

pip install -U langchain-apertis
export APERTIS_API_KEY="..."

Chat completions

from langchain_apertis import ChatApertis

llm = ChatApertis(model="gpt-5.5", temperature=0)
print(llm.invoke("Explain what a native LangChain provider is.").text)

bind_tools() and with_structured_output() use Apertis' OpenAI-compatible tool format. A current Web Search model keeps its exact :web model suffix and exposes source records safely in response_metadata["apertis"]["web_sources"].

search = ChatApertis(
    model="gpt-5.5:web",
    web_results_count=5,
    web_content_length="medium",
)
response = search.invoke("What changed in this week's AI news?")
print(response.response_metadata["apertis"]["web_sources"])

Both current SDK Web Search stream-status shapes are exposed before model text. When the SDK supplies a status string, stream() and astream() retain it and set response_metadata["apertis"]["web_search_status"] to "in_progress".

Multimodal and audio chat

ChatApertis forwards LangChain's OpenAI-shaped image, input-audio, and video content parts directly to the official SDK. Model availability remains account- and model-dependent; the integration preserves the request contract rather than claiming a static catalog.

from langchain_core.messages import HumanMessage

vision = ChatApertis(model="gpt-5.5")
response = vision.invoke(
    [
        HumanMessage(
            content=[
                {"type": "text", "text": "Describe this image."},
                {"type": "image_url", "image_url": {"url": "https://example.com/cat.png"}},
            ]
        )
    ]
)

For audio-output requests, use the Apertis SDK-compatible modalities and audio parameters. Returned audio data is retained in response.additional_kwargs["audio"]; Web Search URL citations are retained in response.response_metadata["apertis"]["annotations"].

The current SDK's response_format and extra_body request fields are also direct ChatApertis constructor parameters.

Development verification

The public package metadata resolves published apertis>=0.3.0 from PyPI.

uv sync --group dev
uv run pytest -m "not integration"
uv build
docker build -t langchain-apertis-test -f Dockerfile.test .
docker run --rm --network none langchain-apertis-test

Publishing

After apertis>=0.3.0 is available on PyPI, configure PyPI Trusted Publishing for apertis-ai/langchain-apertis, .github/workflows/publish.yml, and the pypi environment. The manual Publish to PyPI workflow uploads only when dispatched with the publish confirmation value.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_apertis-0.2.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_apertis-0.2.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file langchain_apertis-0.2.0.tar.gz.

File metadata

  • Download URL: langchain_apertis-0.2.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langchain_apertis-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6274fac14bb72720ec26a5241068ff1a88a17f973679c08056508a109abf7ac0
MD5 215948728a4190f4a73273689161e470
BLAKE2b-256 c8fcd6808caa3e558cf735e9b64b22975c1b14bd1336042cd30586519c24544b

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_apertis-0.2.0.tar.gz:

Publisher: publish.yml on apertis-ai/langchain-apertis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_apertis-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_apertis-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf1747f937ff213e64902c3377a3d3ee567df4d5fa47ebff89bb48efc8edab52
MD5 baf2251093a2f6a4c99a5138f1e88089
BLAKE2b-256 3db8595a3877927b14aaf025be80620562ba9f9bb802c5fcb40e5f8cdc9f75ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_apertis-0.2.0-py3-none-any.whl:

Publisher: publish.yml on apertis-ai/langchain-apertis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page