LangChain with DEVUP AI
Build production-grade AI applications and autonomous agents with LangChain and DEVUP AI. Because DEVUP AI exposes a fully OpenAI-compatible REST API, you can use standard langchain-openai to access 200+ catalog models with LCEL chains, streaming, and tool calling without proprietary wrappers.
ChatOpenAI class communicates directly with DEVUP AI's verified OpenAI-compatible endpoint at https://api.devupai.com/v1.Architecture Flow
How LangChain Integrates with DEVUP AI
Setting openai_api_base to https://api.devupai.com/v1directs all prompt executions, structured outputs, and streaming iterations to DEVUP AI's high-throughput inference cluster.
Installation
Install Packages
Install the standard langchain-openai package using pip:
pip install langchain-openaiConfiguration
Initialize ChatOpenAI Client
Configure ChatOpenAI with your DEVUP AI API key and point openai_api_base to the platform gateway:
import os
from langchain_openai import ChatOpenAI
# Initialize ChatOpenAI pointing to the DEVUP AI gateway
chat = ChatOpenAI(
openai_api_key=os.environ["DEVUP_API_KEY"],
openai_api_base="https://api.devupai.com/v1",
model_name="deepseek-ai/DeepSeek-V4-Pro",
)OPENAI_API_BASE="https://api.devupai.com/v1" and OPENAI_API_KEY directly in your environment to run standard LangChain code without specifying parameters.Text Generation
One-Shot Generation with invoke
Execute standard chat completion calls using the unified invoke method:
from langchain_openai import ChatOpenAI
# Initialize the DEVUP AI endpoint
chat = ChatOpenAI(
openai_api_key="your-devup-api-key",
openai_api_base="https://api.devupai.com/v1",
model_name="deepseek-ai/DeepSeek-V4-Pro",
)
response = chat.invoke("Hello, DEVUP AI!")
print(response.content)Real-Time Streaming
Token Streaming with stream
Stream response tokens in real-time by setting streaming=True and iterating over response chunks:
from langchain_openai import ChatOpenAI
chat = ChatOpenAI(
openai_api_key="your-devup-api-key",
openai_api_base="https://api.devupai.com/v1",
model_name="deepseek-ai/DeepSeek-V4-Pro",
streaming=True,
)
for chunk in chat.stream("Explain quantum computing in 3 sentences."):
print(chunk.content, end="", flush=True)LCEL Composition
Building Pipelines with LCEL
Compose prompts, models, and parsers into production pipelines using the pipe (|) operator:
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
chat = ChatOpenAI(
openai_api_key="your-devup-api-key",
openai_api_base="https://api.devupai.com/v1",
model_name="deepseek-ai/DeepSeek-V4-Pro",
)
prompt = ChatPromptTemplate.from_messages([
("system", "You are a senior {language} developer."),
("human", "{question}"),
])
chain = prompt | chat
response = chain.invoke({
"language": "Python",
"question": "What is the best way to handle async in Python 3.12?",
})
print(response.content)Capabilities Matrix
Verified LangChain Features
ChatOpenAI & Invocation
Full compatibility with LangChain's standard OpenAI chat model integration.
- Compatible with
chat.invoke()and batching - Token-by-token streaming via
chat.stream() - Async execution with
ainvoke()andastream()
LCEL & Advanced Workflows
Composable pipeline orchestration with output parsing and tool calling.
- Compatible with LangChain Expression Language (
|operator) - Structured outputs with Pydantic via
with_structured_output - Tool and function binding via
bind_tools
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| openai_api_base | str | "https://api.devupai.com/v1" | DEVUP AI OpenAI-compatible endpoint URL |
| openai_api_key | str | os.environ["DEVUP_API_KEY"] | Your DEVUP AI API key from dashboard |
| model_name | str | "deepseek-ai/DeepSeek-V4-Pro" | Any active model identifier from the DEVUP AI catalog |
| temperature | float | 0.7 | Sampling temperature between 0.0 and 2.0 |
| streaming | bool | False | Enable real-time token streaming |
Build AI Applications with LangChain Today
Get your API key, configure ChatOpenAI with our base URL, and build production chains with Algerian Dinar billing.