Skip to main content
LangChain is a framework for LLM apps — chains, agents, RAG. Since RuAPI is OpenAI-compatible, connecting comes down to the ChatOpenAI class with base_url set to https://www.ruapi.ai/v1 — no separate integration needed.

Prerequisites

1

RuAPI account and API key

Console → API Keys → create an sk-... key. The balance tops up in USDT — see Top-up.

Python

From here llm drops into any chain, agent or LCEL construct like a regular model.

JavaScript / TypeScript

To switch models, change the model field. The same key reaches Claude, GPT, Gemini, DeepSeek and more.

Embeddings for RAG

For document search RuAPI offers the embedding models text-embedding-3-small (1536 dimensions) and text-embedding-3-large (3072). Use them with the same key via OpenAIEmbeddings:
Split long documents into chunks first (a text splitter): with this setting LangChain no longer cuts texts over 8,191 tokens itself, and it sends the chunks in batches of chunk_size. emb works with any LangChain vector store (FAISS, Chroma and others), and llm from the example above writes the answers from the retrieved chunks. Embedding models unlock after a top-up; prices are on the Pricing page.

Troubleshooting

api_key must be a RuAPI key (sk-...). Check for stray spaces.
The name in model must match RuAPI verbatim — see the pricing page.
No. Claude is called through ChatOpenAI on the same base_url — just put the Claude model ID in the model field.