Documentation / Connect

Connect → LlamaIndex

Use AxForge with LlamaIndex

LlamaIndex connects models to your data: indexes, retrieval, agents. Its OpenAILike class is made for OpenAI-compatible services such as AxForge.

Before you start
  • An AxForge API key, in the environment variable AXFORGE_API_KEY. Get one (a minute).
  • Python 3.10 or newer. Run with llama-index-llms-openai-like 0.8.1 (llama-index-core 0.14.25) on 2026-10-17.

Set it up

  1. Install the OpenAILike package

    pip install llama-index-llms-openai-like
  2. Point OpenAILike at AxForge

    import os
    from llama_index.llms.openai_like import OpenAILike
    
    llm = OpenAILike(
        api_base="https://api.axforge.ai/v1",
        api_key=os.environ["AXFORGE_API_KEY"],
        model="qwen3.8-27b-nvfp4",
        is_chat_model=True,
        is_function_calling_model=True,
        context_window=262144,
    )
    print(llm.complete("Say hello in five words"))

    OpenAILike cannot ask our models what they can do, so you tell it: they are chat models, they call tools, and they read 262,144 tokens at once.

  3. Run it

    python hello.py
    The LlamaIndex script shown in a terminal and run, printing a five-word hello

To use it everywhere in LlamaIndex: from llama_index.core import Settings, then Settings.llm = llm.

The settings

ArgumentValue
api_basehttps://api.axforge.ai/v1
api_keyyour AxForge key
modelqwen3.8-27b-nvfp4, glm-5.3-flash or mimo-v2.6-flash
is_chat_model · is_function_calling_modelTrue · True
context_window262144

Which model for what: qwen3.8-27b-nvfp4 is the everyday default and reads images, glm-5.3-flash thinks before it answers, mimo-v2.6-flash is the fastest.

Check that it works

The script prints an answer. The call shows in the console under API Keys → Recent calls within a minute.

When it does not work

What you seeWhat it meansFix
AuthenticationError, 401 "Invalid API key. Create one at https://console.axforge.ai/keys."the key was refusedcheck AXFORGE_API_KEY holds the whole key, or make a new one
KeyError: 'AXFORGE_API_KEY'the variable is not set in this terminalset it as on Get your API key

Test a call says in one click whether a problem is your key, your balance or us.

Ask on the forum Markdown For AI Updated 2026-10-17

Anything unclear on this page?

Ask on the forum. The answer helps the next person too.

Ask about this page