weightsapi.INFERENCEConsole
Navigation
LlamaIndex (Python)

LlamaIndex (Python)

Configure LlamaIndex (Python) with the WeightsAPI OpenAI-compatible endpoint.

Before you connect#

AI access requires sign-in, one confirmed top-up of at least USD 100, an authorized API key and enough available credit for the request. Each later top-up also has a USD 100 minimum; smaller remaining balances stay usable when they cover the request. Credit requires transaction verification. Check service status for model availability before sending traffic. Use your own API key without the Bearer prefix in key fields. The base URL already includes /v1. These configurations were checked against official documentation, not tested against a live GPU deployment.

Configuration#

Install llama-index-llms-openai-like, then:

import os
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model="Qwen/Qwen3-32B",
    api_base=os.environ["https://weightsapi.com/v1"],
    api_key=os.environ["WEIGHTSAPI_API_KEY"],
    is_chat_model=True,
    is_function_calling_model=False,
)
print(llm.complete("Say hello in one sentence."))

Use OpenAILike for arbitrary compatible model IDs. The exact URL parameter is api_base. Set context_window from the actual deployment when using RAG or long inputs. Change is_function_calling_model to true only after endpoint support is confirmed.

Source: Current OpenAILike API reference.

Verify the connection#

Fetch the model list, then send one short message. A successful model list does not prove tools, vision or JSON schema support. Check the selected deployment’s capabilities before enabling them.