Skip to content

TextCortex API guides

Use the TextCortex API with LangChain

Configure LangChain ChatOpenAI with the TextCortex API base URL. Access proprietary and open-weight models from the same integration.

Use the TextCortex API with LangChain

The practical takeaway

Build on a multi-model API.

Use LangChain’s OpenAI-compatible client with TextCortex credentials and a model from your account catalog. Keep model choice configurable as you build chains and agents.

Install the client integration

Install langchain-openai in your Python environment. Generate a TextCortex API key, store it server-side as TEXTCORTEX_API_KEY, and choose an identifier from GET /models for TEXTCORTEX_MODEL.

The base URL is https://api.textcortex.com/v1. Do not append /chat/completions to a client base URL; the client constructs the endpoint.

Create a ChatOpenAI client

This minimal example uses the configured model. Change that identifier to evaluate another supported model while keeping the client configuration.

import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://api.textcortex.com/v1",
    api_key=os.environ["TEXTCORTEX_API_KEY"],
    model=os.environ["TEXTCORTEX_MODEL"],
)
answer = llm.invoke("Hello")
print(answer.content)

Add capabilities one at a time

After the basic request works, add the streaming, tool schemas or output validation your chain needs. Check support for the exact TextCortex model route rather than assuming that all OpenAI client options are portable.

Pin the package versions you validate and keep a small request fixture set. This makes SDK upgrades and model changes easier to assess separately.

Keep routing and retrieval under your control

Use application configuration to select models for different chains. GPT, Claude, Gemini and open-weight models can share the TextCortex connection while serving different tasks.

If a chain retrieves documents, apply permissions before sending context to the model. For European processing requirements, select EU-hosted routes for every model call in the chain.

Questions

Your next questions, answered.

Is TextCortex limited to open-source models?

No. The API provides access to proprietary model families such as GPT, Claude and Gemini alongside open-weight families such as Kimi, GLM, DeepSeek and MiMo. Use GET /models to list the identifiers available to your account.

Can I use an OpenAI-compatible client?

Yes. Configure the client with the TextCortex base URL and API key. Use a TextCortex model identifier and the parameters supported by that model. Model discovery, chat completions and responses are documented in the API reference.

How do I start using the API?

Sign up for TextCortex, create an API key in your account settings, and use https://api.textcortex.com/v1 as the base URL. Retrieve the model catalog, select a model identifier and send a chat-completion request.

TextCortex AI

One integration. Your choice of models.

Sign up for TextCortex, create an API key and start building with the models your application needs.

Sources and documentation

Product documentation and provider references used for this guide. Reviewed on 5 October 2026.