LangChain Integration
LangChain supports custom model services through OpenAI-compatible client configuration.
Python Example
Section titled “Python Example”from langchain_openai import ChatOpenAIimport os
llm = ChatOpenAI( model="gpt-4o", api_key=os.environ["ROUTEAPI_KEY"], base_url="https://www.routeapi.ai/v1",)
response = llm.invoke("Introduce RouteAPI in one sentence")print(response.content)Recommendations
Section titled “Recommendations”- Verify the model and Token with cURL first.
- Then connect LangChain.
- If you use tools or structured output, confirm that the selected model supports the capability.