For the complete documentation index, see llms.txt. This page is also available as Markdown.

LlamaIndex

Use LlamaIndex with Cortecs through Chat Completions

LlamaIndex provides an OpenAI-compatible adapter for custom inference services. The adapter uses Chat Completions, so treat this integration as a fallback when your workflow cannot use the Cortecs Responses API.

1. Install the adapter

pip install llama-index-llms-openai-like

2. Connect to Cortecs

import os

from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model=os.environ["CORTECS_MODEL"],
    api_base="https://api.cortecs.ai/v1",
    api_key=os.environ["CORTECS_API_KEY"],
    is_chat_model=True,
    is_function_calling_model=True,
)

response = llm.complete("Explain semantic search in two sentences.")
print(response)

Set is_function_calling_model=True only when the selected model lists tools in supported_features in the Models API. For Responses-native agents, use the OpenAI SDK, Vercel AI SDK or Pydantic AI instead.

See the LlamaIndex OpenAI-like adapter source and usage guide for current adapter options.

Last updated