Skip to main content

hypnex-openai (Python)

Drop-in OpenAI client for the Morpheus decentralized inference network (mor.org).

pip install hypnex-openai

Affiliation & monetization

This SDK is published by Hypnex Labs. It is a thin OpenAI-compatible client; calls go directly to api.mor.org and are billed by Morpheus AI to the API-key holder. This SDK does not currently route fees to Hypnex Labs. Hypnex's revenue comes from the sister SDK hypnex-staking (MRC 73 capital referral) and the stake.hypnex.xyz onramp. Hypnex is not affiliated with the Morpheus AI Foundation.

from hypnex_openai import HypnexOpenAI

client = HypnexOpenAI(api_key="mor_...")  # get one at https://app.mor.org

response = client.chat.completions.create(
    model="mistral-31-24b",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

HypnexOpenAI subclasses openai.OpenAI and points it at https://api.mor.org/api/v1. Streaming, tools, async, structured output — all work unchanged.

Models on the Morpheus network

The network exposes 60+ models via OpenAI-compatible endpoints. List them:

hypnex models

Or programmatically:

client.morpheus.active_models()           # full registry
client.morpheus.models_by_type("LLM")     # filter
client.morpheus.find_model("glm-5")       # lookup

Featured LLMs: mistral-31-24b, glm-5, qwen3-235b, qwen3-coder-480b-a35b-instruct, deepseek-r1:70b, minimax-m25. Embeddings: text-embedding-bge-m3. TTS: tts-kokoro. STT: whisper-1.

Drop-in for popular frameworks

Any framework that accepts a base_url accepts Morpheus:

# LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
    model="qwen3-235b",
    api_key=os.environ["HYPNEX_API_KEY"],
    base_url="https://api.mor.org/api/v1",
)

# CrewAI
from crewai import LLM
llm = LLM(
    model="openai/qwen3-235b",
    api_key=os.environ["HYPNEX_API_KEY"],
    base_url="https://api.mor.org/api/v1",
)

# llama-index
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
    model="qwen3-235b",
    api_base="https://api.mor.org/api/v1",
    api_key=os.environ["HYPNEX_API_KEY"],
    is_chat_model=True,
)

# instructor
import instructor
client = instructor.from_openai(HypnexOpenAI())

Morpheus-specific endpoints

client.morpheus.* exposes endpoints that have no OpenAI equivalent:

Method What it does
balance() Current MOR balance
transactions(limit=50) Billing history
spending() Cumulative usage
me() User profile
list_keys() / create_key(name) / delete_key(id) / set_default_key(id) API keys
link_wallet(addr, sig, msg) / get_wallet() / unlink_wallet() Wallet binding
active_models() / find_model(name) / models_by_type(type) Public registry

CLI

hypnex models                          # list
hypnex health                          # show api.mor.org health
hypnex chat "Hello" --model glm-5      # one-shot

Async

from hypnex_openai import AsyncHypnexOpenAI
client = AsyncHypnexOpenAI(api_key="mor_...")
r = await client.chat.completions.create(...)

Environment

  • HYPNEX_API_KEY — your API key (required)
  • HYPNEX_BASE_URL — override base URL (default https://api.mor.org/api/v1)

Tests

pip install -e ".[dev]"
pytest                                   # public smoke tests
HYPNEX_API_KEY=mor_... pytest          # also run authenticated tests

License

MIT

Metadata

Release files for hypnex-openai 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hypnex-openai 0.1.1
File Size Uploaded Provenance
hypnex_openai-0.1.1.tar.gz 45.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hypnex-openai 0.1.1
File Interpreter ABI Platform
hypnex_openai-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.3 kB

Release files / hypnex_openai-0.1.1.tar.gz

Download URL hypnex_openai-0.1.1.tar.gz
Size 45.0 kB
Tags Source
SHA-256 checksum
How to use checksums
372ed391c8b9d6f45038c7dae3831589eef1bf0d6a4aaf67129d4879cf4eb639
BLAKE2b-256 checksum
How to use checksums
dfd9cf07dda1c47d748db6e93cc0608c8f6f014461acd9bf9bd0644ba7068164
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / hypnex_openai-0.1.1-py3-none-any.whl

Download URL hypnex_openai-0.1.1-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49f882a2a5be788d4f11a11dd3d5e0d11b1ba1839bd5f7fe217e2024cd1c0ef4
BLAKE2b-256 checksum
How to use checksums
81da53a1dc27371ae254778bf2e86b3b7ac75826f64bbceeba64859f36b61e1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for hypnex-openai 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page