Registry / llm-agents / langchain-nebius

langchain-nebius

JSON →
library0.1.3pypypi✓ verified 22d ago

This package provides LangChain integration for Nebius AI Studio, enabling seamless use of Nebius AI Studio's chat and embedding models within LangChain. It offers classes for chat models (ChatNebius), embedding models (NebiusEmbeddings), and a retriever (NebiusRetriever), facilitating common LLM application patterns like RAG. The current version is 0.1.3.

pip install langchain-nebius
INSTALL
IMPORT
SIG · LANGCHAIN-NEBIUS
L
langchain-nebius
llm-agentspythonv0.1.3
Install
9.9s avg
Import
5151ms
Disk
102MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 5.374s · 99.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 9.9s · import 4.928s · 108MB
102MB installed
● package 102MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ChatNebius
from langchain_nebius import ChatNebius
NebiusEmbeddings
from langchain_nebius import NebiusEmbeddings
NebiusRetriever
from langchain_nebius import NebiusRetriever
NebiusRetrievalTool
from langchain_nebius import NebiusRetrievalTool

This example demonstrates how to initialize `ChatNebius` and invoke it with a simple query. Ensure your `NEBIUS_API_KEY` is set as an environment variable for secure credential management. You may need to select a specific model available in Nebius AI Studio.

import os from langchain_nebius import ChatNebius from langchain_core.messages import HumanMessage # Set your Nebius API key as an environment variable # os.environ["NEBIUS_API_KEY"] = "your_nebius_api_key" chat = ChatNebius( api_key=os.environ.get('NEBIUS_API_KEY', ''), model="Qwen/Qwen3-14B", # Choose an available model from Nebius AI Studio temperature=0.6 ) response = chat.invoke([ HumanMessage(content="What is 1 + 1?") ]) print(response.content)
Debug
Known issues
gotchaAPI Key Management: Nebius requires an API key for authentication. It's recommended to set it as an environment variable named `NEBIUS_API_KEY` rather than passing it directly in code for security reasons.
fix
Set `export NEBIUS_API_KEY='your_api_key'` in your environment or use a `.env` file and `dotenv`.
affects: All versions
gotchaLangChain Version Compatibility: As the LangChain ecosystem (especially `langchain-core`) evolves rapidly, ensure your installed `langchain-nebius` version is compatible with your core LangChain packages to avoid import errors or unexpected behavior.
fix
Refer to the `langchain-nebius` GitHub repository or PyPI page for explicit `langchain-core` version requirements. Use `pip install -U langchain-nebius` to get the latest compatible version.
affects: All versions
gotchaModel String Variations: The `model` parameter for `ChatNebius` and `NebiusEmbeddings` expects a specific string identifier. These identifiers may vary or new models may become available. Refer to the Nebius AI Studio documentation for the most current list of supported models.
fix
Consult the official Nebius AI Studio documentation for up-to-date model names and availability. Avoid hardcoding model names if they are subject to frequent changes.
affects: All versions
gotchaRate Limiting and Context Length: Like most LLM providers, Nebius AI Studio may impose rate limits and have maximum context window sizes for its models. Hitting these limits can lead to errors.
fix
Implement retry mechanisms with exponential backoff for API calls. Monitor token usage and truncate input or summarize history if close to context limits. Review Nebius AI Studio's API documentation for specific rate limits and model context window sizes.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'langchain_nebius'
The 'langchain-nebius' package is not installed in your Python environment, or your current environment does not have it activated.
fix
Ensure the package is installed in your active Python environment: `pip install langchain-nebius`
AuthenticationError: Invalid credentials for Nebius AI Studio
The Nebius AI Studio API key is either missing, invalid, or incorrectly configured as an environment variable or initialization parameter.
fix
Set the `NEBIUS_API_KEY` environment variable (e.g., `export NEBIUS_API_KEY='your_api_key'`) or pass it directly during initialization: `ChatNebius(api_key='your_api_key', ...)`.
ValueError: Model 'invalid-model-name' not found or unsupported by Nebius AI Studio.
The model string provided to `ChatNebius` or `NebiusEmbeddings` does not match an available or correct model identifier in Nebius AI Studio.
fix
Consult the official Nebius AI Studio documentation for the most current list of supported model names and use a valid identifier, e.g., `ChatNebius(model='Qwen/Qwen3-14B')`.
ImportError: cannot import name 'ChatNebius' from 'langchain_nebius'
This usually indicates a version incompatibility between `langchain-nebius` and other core LangChain packages (`langchain`, `langchain-core`) due to rapid updates in the LangChain ecosystem.
fix
Upgrade `langchain-nebius` and your main `langchain` and `langchain-core` packages to their latest compatible versions: `pip install -U langchain-nebius langchain langchain-core`.
Upgrade
Version history
0.1.3latest on PyPI · released Jun 29, 2025
Audit
Dependencies
langchain-corerequiredCore abstractions for LangChain integrations.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
langchain-nebius — pip install langchain-nebius · libregistry