Integrations
LangChain
Use DEVUP AI models with LangChain's ChatOpenAI class for seamless Python AI workflows.
Because DEVUP AI exposes a fully OpenAI-compatible API, you can use it as a drop-in replacement in any LangChain pipeline. Point your openai_api_base to our gateway and access 142+ open-source models with zero code changes to your existing chains.
Prerequisites
- A DEVUP AI account with a valid API key (Dashboard → API Keys).
- Python 3.9 or later.
- The
langchain-openaipackage installed.
Installation
pip install langchain-openaiBasic Usage
Pass your DEVUP API key and gateway URL to ChatOpenAI. All 142+ models available on the platform are accessible via the model_name parameter.
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-chat" # or any of our 142+ models
)
response = chat.invoke("Hello, DEVUP AI!")
print(response.content)Using Environment Variables
For production deployments, store your API key in an environment variable instead of hardcoding it:
export DEVUP_API_KEY="sk-devup-your_key_here"import os
from langchain_openai import ChatOpenAI
chat = ChatOpenAI(
openai_api_key=os.environ["DEVUP_API_KEY"],
openai_api_base="https://api.devupai.com/v1",
model_name="deepseek-chat",
)Streaming Responses
Enable streaming to receive tokens as they are generated. This is ideal for real-time UIs and long-form content generation:
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-chat",
streaming=True,
)
for chunk in chat.stream("Explain quantum computing in 3 sentences."):
print(chunk.content, end="", flush=True)Building Chains with LCEL
DEVUP AI works seamlessly with LangChain Expression Language (LCEL). Compose prompts, models, and output parsers into production pipelines:
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-chat",
)
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)Configuration Options
Fine-tune model behavior using standard OpenAI parameters:
chat = ChatOpenAI(
openai_api_key="your-devup-api-key",
openai_api_base="https://api.devupai.com/v1",
model_name="deepseek-chat",
temperature=0.2, # Lower = more deterministic
max_tokens=2048, # Max completion length
request_timeout=30, # Timeout in seconds
)| Parameter | Type | Description |
|---|---|---|
| openai_api_base | str | Always https://api.devupai.com/v1 |
| openai_api_key | str | Your DEVUP AI API key (prefixed with sk-devup-). |
| model_name | str | Any supported DevUp model alias or full model ID. |
| temperature | float | Sampling temperature (0.0–2.0). Default: 0.7. |
| max_tokens | int | Maximum number of completion tokens to generate. |
| streaming | bool | Enable token-by-token streaming. Default: False. |
Notes
- DEVUP AI is fully OpenAI-compatible — any LangChain component that uses
ChatOpenAIorOpenAIEmbeddingsworks out of the box. - Tool calling, structured outputs, and function calling are supported on models that natively support them.
- All requests are metered and billed in Algerian Dinar (DZD) via your account balance.
openai_api_base to https://api.devupai.com/v1 and swapping your API key. All existing chains, agents, and tools remain fully compatible.