Guide · LlamaIndex

Connect LlamaIndex to Synap

3 steps · about 2 minutes

  1. Get a free key

    Sign in with Google at synap.linkrra.com — no card. Your key starts with sk-pool-.

  2. Point OpenAILike at Synap

    is_chat_model=True is not optional — without it the class posts to /v1/completions instead of /v1/chat/completions.

    # pip install llama-index-llms-openai-like
    import os
    from llama_index.llms.openai_like import OpenAILike
    
    llm = OpenAILike(
        model="qwen3-coder-30b",
        api_base="https://synap.linkrra.com/v1",
        api_key=os.environ["SYNAP_API_KEY"],
        is_chat_model=True,
        context_window=98304,
    )
    print(llm.complete("Write a haiku about diffs"))
  3. Make it the default

    Set it once on Settings and every engine, agent and query pipeline in your app uses it.

    from llama_index.core import Settings
    from llama_index.core.llms import ChatMessage
    
    Settings.llm = llm
    print(Settings.llm.chat([ChatMessage(role="user", content="Say OK")]).message.content)
Notes, prices and limits

OpenAILike with a base URL, then Settings.llm. Recommended model: qwen3-coder-30b — $0.0675 in and $0.27 out per 1M tokens, 98,304-token context.

Run live against this API with llama-index-core 0.14.25 and llama-index-llms-openai-like 0.8.1 — complete, chat and stream_complete.

context_window is what LlamaIndex uses to decide how much it may pack into one prompt. The number above is this model’s own context length, from /v1/models.

Synap serves chat models. There is no embeddings endpoint here, so set Settings.embed_model to your own — a local HuggingFace model is enough. Leave it unset and LlamaIndex reaches for OpenAI embeddings and asks for an OpenAI key.

There is no Synap-specific LlamaIndex package to install. OpenAILike is the supported path and the one proven here.

On the free tier: every request counts input and output against 100,000 free tokens a day, and answers stop at 4,096 output tokens. Coding agents send long prompts, so the free tier covers a short session; credits cover the rest.

Field names from LlamaIndex docs: LLM module guide, run against this API, checked 2026-11-03 17:45 UTC. Prices refresh from /v1/models when this page loads.