langchain-openai: point the chat and embedding clients at the LaoZhang API base URL and pass your key. GPT-6, Gemini, DeepSeek, and other text models all work with the same client.
Install and configure
model, for example to gemini-3.8-flash or deepseek-v4-flash. Prices are in the model catalog.
You can also set the OPENAI_API_KEY and OPENAI_BASE_URL environment variables and leave api_key and base_url out of your code.
Call tools
tool_calls returns the tool name and arguments, such as {'name': 'get_weather', 'args': {'city': 'Paris'}}. After running the tool, send the result back as a ToolMessage, or let a LangGraph agent handle the loop.
Stream the output
Use the Responses API
When you need features of OpenAI’s Responses API, adduse_responses_api=True:
Create embeddings
FAQ
I get “Unsupported parameter: ‘max_tokens’”
GPT-6 models don’t acceptmax_tokens. Setting the output limit through ChatOpenAI’s own argument usually works; if you added that field by hand in extra request parameters, rename it to max_completion_tokens. See max_tokens.
I get a 401 or 404
Make surebase_url is https://api.laozhang.ai/v1 and isn’t overridden by an environment variable such as OPENAI_BASE_URL. See Invalid API key or 404.