Skip to main content

LangChain integration for XYNQ — decentralized OpenAI-compatible inference.

Project description

langchain-xynq

LangChain / LangGraph integration for XYNQ — decentralized, OpenAI-compatible inference.

pip install langchain-xynq

Quick start

import os

os.environ["XYNQ_API_KEY"] = "xynq_sk_..."  # or export in your shell

from langchain_xynq import ChatXYNQ

llm = ChatXYNQ.smart(temperature=0.7)
print(llm.invoke("Explain backpropagation in two sentences.").content)

Get a key at xynq.aiAccount (1M free tokens/month).

API

ChatXYNQ

Drop-in ChatOpenAI subclass with XYNQ defaults:

Default Value Override
Base URL https://xynq.ai/v1 XYNQ_BASE_URL or base_url=
API key XYNQ_API_KEY api_key=
Model xynq-1 model=
from langchain_xynq import ChatXYNQ, FAST_MODEL, SMART_MODEL

fast = ChatXYNQ.fast()           # xynq-1
smart = ChatXYNQ.smart()         # xynq-glm-5.2
custom = ChatXYNQ(model="xynq-qwen-3.5-27b", temperature=0)

Streaming works like any LangChain model:

for chunk in ChatXYNQ.smart().stream("Count to five."):
    print(chunk.content or "", end="", flush=True)

LangGraph

Use ChatXYNQ anywhere you would use ChatOpenAI:

from langgraph.prebuilt import create_react_agent
from langchain_xynq import ChatXYNQ

agent = create_react_agent(ChatXYNQ.smart(), tools=[...])
agent.invoke({"messages": [("user", "Hello")]})

Runnable examples: examples/langgraph-xynq/

Models

Alias Model id
ChatXYNQ.fast() xynq-1
ChatXYNQ.smart() xynq-glm-5.2
xynq-qwen-3.5-27b
xynq-supergemma-4-26b

Node / TypeScript

Use @xynqai/langchain for the JavaScript equivalent.

Related

License

MIT

Project details


Download files

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

Source Distribution

langchain_xynq-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

langchain_xynq-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_xynq-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_xynq-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for langchain_xynq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 759aff0e343861711e73951e4edb99f93b7977fa2556a7dfb7a37acdf2e7af3b
MD5 2e4aad8823dfcf826a01a09a7210fe58
BLAKE2b-256 c38192379fc3d078ec4c9001d234448eb7a3cfeb6fdf7c1d0883a112d3595301

See more details on using hashes here.

File details

Details for the file langchain_xynq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: langchain_xynq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for langchain_xynq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 671316db6ce0222a9848cd8e2d2bf6212ee19b65c12774ba2b7b6d196a02c3b5
MD5 1f40578971daddc0849fa9fd58e18388
BLAKE2b-256 3afd1773458d6fd5d49b1673a27e7d4055b97795959abefde5ef8a598d4b7935

See more details on using hashes here.

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