Skip to content
Ruvicode logo
Ruvicode
USD
All integrations

Python framework

How to Use Ruvicode with LangChain

LangChain's ChatOpenAI class talks to any OpenAI-compatible API. Pointing it at Ruvicode gives every chain and agent in your code access to the whole model catalog, tool calling included.

Tested on November 3, 2026. langchain-openai 1.7.3 returned a plain answer and a tool call with its arguments through api.ruvicode.com with the code below.

Set up LangChain

Base URL

https://api.ruvicode.com/v1

API key

rvcd_...

  1. 1Install the package: pip install langchain-openai.
  2. 2Create ChatOpenAI with base_url https://api.ruvicode.com/v1, your rvcd_ key and a model id from the catalog.
  3. 3Use it like any LangChain chat model: invoke, stream, bind_tools, or inside an agent.
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="glm-5.3-flash",
    api_key=os.environ["RUVICODE_API_KEY"],
    base_url="https://api.ruvicode.com/v1",
)
print(llm.invoke("Hello").content)
def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return "sunny"

msg = llm.bind_tools([get_weather]).invoke("What is the weather in Paris?")
print(msg.tool_calls)  # [{'name': 'get_weather', 'args': {'city': 'Paris'}, ...}]

Good to know

  • Switch models by changing the model argument; the base URL and key stay the same for Claude, GPT, Gemini, GLM, Kimi and the rest.
  • Leave use_responses_api off. Ruvicode serves chat completions, not the Responses API.

Models for coding agents

These models completed streamed tool calls through Ruvicode on November 3, 2026. Every model in the catalog works with the same base URL and key; each model page shows its live rate, context window and max output.

Common errors

401 Invalid API key
The key is mistyped, revoked or not a Ruvicode key. Copy it again from the dashboard; it starts with rvcd_.
404 Model not found
The model id is not in the catalog. Use an id exactly as listed on the models page or by GET /v1/models. A plain 404 page instead of a JSON error means the base URL is missing /v1.
402 insufficient_balance
The wallet cannot cover the request. Top up in the dashboard; the balance never expires.
429 rate limit
Too many requests per minute, on the key or across the account. Agents that fire many calls in parallel can hit it; most tools retry on their own after a short wait.

LangChain with Ruvicode: FAQ

Does LangChain tool calling work through Ruvicode?
Yes. bind_tools sends OpenAI-style tools, and the model's tool calls come back with their arguments intact. GLM 5.3 Flash returned get_weather with city Paris in our test.
Where do I get a Ruvicode API key?
Create an account, top up your wallet with QRIS or USDC, then open API Keys in the dashboard and create a key. Keys start with rvcd_. You can set a daily or monthly spend limit per key and restrict a key to a list of models.