Connect LangChain
Point ChatOpenAI at a custom Chat Completions endpoint without changing your existing chains.
https://aelder.dev/v1LOCAL CONFIGURATION
Let my agent set this up
Copy this task to an agent already running on your computer. Enter your API key locally when asked.
Help me connect LangChain to AELDER using this guide: https://aelder.dev/docs/langchain/
Service Base URL: https://aelder.dev/v1
First inspect my installed version, active profile and configuration. Explain any mismatch with the guide before changing anything.
Use the documented local configuration or CLI method. Do not automate the GUI, install software or change permissions without asking.
Preserve existing accounts, providers, models, defaults, permissions and unrelated settings. Propose the smallest change, show a redacted diff, and back up any files before editing.
Have me enter my API key locally using the tool's secret storage or an environment variable. Never ask me to paste a key into chat, print it, or include it in a command, diff, log or commit.
Use the exact model ID I choose from my account's model list. Do not invent model IDs or assume every model supports every API format or tool feature.
Validate syntax and configuration loading before making any generation request. If there is no dry-run, say so.
Explain any proposed paid test, the model and what it sends, and ask for approval before running it. Do not send project files or private conversation history as a test.
Finish with the settings changed, checks performed and steps to restore the backup.LangChain’s ChatOpenAI accepts a custom endpoint. Use it as the text model in your existing Python application; this recipe deliberately selects Chat Completions.
1. Prepare the project
Install the integration in your project’s virtual environment:
python -m pip install langchain-openaiProvide SERVICE_API_KEY privately in that environment. Set SERVICE_BASE_URL to the Base URL above, including /v1, and SERVICE_MODEL_ID to an exact ID from your model list.
2. Configure the chat model
import os
from langchain_openai import ChatOpenAI
model = ChatOpenAI(
model=os.environ["SERVICE_MODEL_ID"],
base_url=os.environ["SERVICE_BASE_URL"],
api_key=os.environ["SERVICE_API_KEY"],
use_responses_api=False,
max_retries=0,
)
reply = model.invoke("Reply with OK.")
print(reply.content)The invoke call sends a billable request. Reuse this model object where your chain expects a chat model. To switch models, update the exact ID and recreate the object; do not assume a display name or built-in alias is valid.
3. Validate before a larger workflow
First import and construct the model without calling invoke. Then, when ready, send the short prompt and check its model in your dashboard. Configuration loading alone does not verify a network connection.
For agents, choose a model with tool-call support and test a small tool task separately. OpenAI-hosted web search, files, remote tools and Responses-specific features are not enabled by this configuration. LangChain tracing is a separate integration; existing tracing settings may send prompts and responses to another service. Review them before passing private data.
Sources: LangChain’s ChatOpenAI guide and integration reference.
Need the key? Open your AELDER dashboard. For direct API calls, see the API reference.

