LlamaIndex RAG Pipeline Integration on API Store Hub

Configure both chat LLM and Embedding models through a single https://apistorehub.com/v1 gateway for accurate enterprise document retrieval.

Ready to ship production AI with one unified API key, VND billing, and multi-provider failover on API Store Hub?

LlamaIndex RAG Pipeline Integration on API Store Hub visual architecture diagram — API Store Hub
LlamaIndex RAG Pipeline Integration on API Store Hub · Base URL https://apistorehub.com · Key prefix sk-ash-

Install command

LanguagePython
RuntimePython 3.10+, llama-index-core, llama-index-llms-openai-like
ProtocolOpenAI Compatible (/v1/chat/completions, /v1/embeddings)
Install commandpip install -U llama-index-core llama-index-llms-openai-like

3-step quickstart setup

  1. Create an API key on API Store Hub: Sign in to the API Store Hub console, generate a key with prefix sk-ash-, and optionally attach daily or monthly spend caps.
  2. Install SDK & set Base URL: Install the official package and configure environment variables pointing to https://apistorehub.com for /v1/chat/completions.
  3. Run inference with streaming & retry: Invoke gemini-4-neon with explicit timeout and jittered retries; every request logs tokens, TTFT, and exact cost.

Production-ready code sample

Python

import os
from llama_index.core import Document, Settings, VectorStoreIndex
from llama_index.llms.openai_like import OpenAILike

Settings.llm = OpenAILike(
    model="gemini-4-neon",
    api_base="https://apistorehub.com/v1",
    api_key=os.environ["API_KEY"],
    context_window=200000,
    is_chat_model=True,
    is_function_calling_model=True,
)

docs = [Document(text="Credit ST uses a 1:1 VND rate across all gateway models.")]
index = VectorStoreIndex.from_documents(docs)
engine = index.as_query_engine(similarity_top_k=5)
print(engine.query("How does ST billing work?"))

cURL

curl https://apistorehub.com/v1/chat/completions \
  -H "Authorization: Bearer sk-ash-your_key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-4-neon","messages":[{"role":"system","content":"Answer only from context."},{"role":"user","content":"Context: 1 ST = 1 VND. Question: What is 1 ST?"}]}'

Recommended models with live pricing

ModelToken priceContext & Endpoint
Gemini 4 Neon20,400 ST / 1M tokens2M
Claude Sonnet 5.57,700 ST / 1M tokens1M
DeepSeek V4 Flash1,500 ST / 1M tokens1M

Production hardening checklist

  • Keep chunk_size between 512 and 1024 tokens and retrieve only top-k relevant chunks to keep prompts tight and cost-efficient.
  • Enable stream=true for long completions (> 500 tokens) to keep connections responsive and minimize time-to-first-token (TTFT).
  • Never hard-code API keys in client bundles; load them from server environment variables and rotate keys periodically in API Store Hub.
  • Configure exponential backoff with jitter for HTTP 429/502/529 and keep a secondary fallback model on the exact same API key.

Frequently asked questions

Does integrating LlamaIndex RAG Pipeline with API Store Hub require rewriting existing calls?
No. API Store Hub preserves native OpenAI (https://apistorehub.com/v1) and Anthropic Messages (https://apistorehub.com/v1/messages) schemas—just update the Base URL and sk-ash- API key.
Can one API key handle streaming, function calling, and embeddings?
Yes. A single API Store Hub key works across all 187 models, including SSE streaming, strict JSON Schema outputs, tool calling, and embeddings.
How are billing and rate limits controlled?
Every request is metered transparently by token or request in the API Store Hub console, never overdrafts your balance, and supports per-key spend caps.