FinGPT के agent pipelines को एक custom OpenAI-compatible endpoint पर चलाएं।
Updated 2026-07-30
FinGPT का multi-agent analysis pipeline अपना LLM एक AG2 LLMConfig dict से configure करता है जो api_type "openai" और एक base_url लेता है। base_url को https://api.apisrouter.com/v1 set करें, एक key pass करें, और researcher, sentiment, और advisor agents catalog के किसी भी model id पर चल सकते हैं।
Quick answer: AG2 LLMConfig dict में base_url।
FinGPT का multi-agent financial analysis pipeline (upstream repo में fingpt/ag2_financial_analysis_pipeline.ipynb) अपना LLM configuration एक AG2 LLMConfig dict के तौर पर चार keys से बनाता है: model, api_key, api_type, और base_url। Upstream notebook खुद base_url को api.openai.com की बजाय एक OpenAI-compatible router endpoint पर point करता है, तो एक gateway के through routing यहां documented pattern है, workaround नहीं। APIsRouter के through pipeline चलाने के लिए, api_type को "openai" set करें, base_url को https://api.apisrouter.com/v1 set करें, api_key में अपनी gateway key डालें, और model को कोई भी catalog id set करें। Notebook का हर AssistantAgent same llm_config object receive करता है, तो एक dict पूरी agent team को move करता है।
from autogen import LLMConfig # ag2[openai]>=0.11.4
llm_config = LLMConfig({
"model": "claude-sonnet-4-6",
"api_key": os.environ["APISROUTER_API_KEY"],
"api_type": "openai",
"base_url": "https://api.apisrouter.com/v1",
})FinGPT असल में LLM API कहां call करता है।
FinGPT (GitHub पर AI4Finance-Foundation, लगभग 21K stars) एक ही नाम के तहत दो चीज़ें है, और आप कौन सा आधा चला रहे हैं यह जानना तय करता है कि एक custom endpoint बिल्कुल matter करता है या नहीं। पहला आधा fine-tuned open weights है: Llama और ChatGLM के लिए LoRA training notebooks जिन्होंने project को मशहूर किया। ये locally या rented GPUs पर Hugging Face transformers के through चलते हैं, कोई chat-completions calls नहीं करते, और इन पर कोई base URL लागू नहीं होता। दूसरा आधा application pipelines है, और यहीं OpenAI-compatible surface रहता है। AG2 multi-agent analysis pipeline तीन AssistantAgents (एक news researcher, एक sentiment analyst, और एक investment advisor) को एक LLMConfig से wire करता है, इन्हें yfinance tool calls और एक local FinBERT sentiment classifier से augment करता है, और इन्हें roles के बीच एक equity analysis pass करने देता है। Financial report analysis pipeline (fingpt/FinGPT_FinancialReportAnalysis) sec-api और Financial Modeling Prep से खींची गई SEC filings के against LangChain के ChatOpenAI को drive करता है। दोनों pipelines standard /v1/chat/completions requests भेजते हैं, दोनों endpoint को एक parameter के तौर पर expose करते हैं, और दोनों model field को एक plain string के तौर पर forward करते हैं, जो यही वजह है कि एक Claude या DeepSeek id एक "openai" api_type पर सवार हो सकती है एक बार base_url के पीछे का endpoint इसे serve करे।
पूरा setup: AG2 pipeline और report-analysis pipeline।
AG2 pipeline सबसे clean integration है। Notebook की LLMConfig values को gateway endpoint और अपनी पसंद की model id से replace करें, और तीनों agents plus उनका tool-calling loop बिना बदले चलते हैं। Financial-data side (yfinance quotes, FinBERT sentiment scoring) local है और API keys से free है, तो LLM endpoint ही एकमात्र external dependency है जिसे आप move कर रहे हैं। Report-analysis pipeline LangChain के ChatOpenAI का इस्तेमाल करता है, जो api_key और base_url को constructor arguments के तौर पर accept करता है; upstream notebook exactly यही pair तब demonstrate करता है जब यह दिखाता है कि एक local OpenAI-compatible server में कैसे swap किया जाए। उन्हीं दो arguments को gateway पर point करें। ध्यान दें कि यह notebook अपने data pulls के लिए SEC और Financial Modeling Prep credentials भी चाहता है; वे market-data keys हैं, LLM endpoint से unrelated, और वे जैसी हैं वैसी ही रहती हैं।
import os
from autogen import AssistantAgent, LLMConfig
llm_config = LLMConfig({
"model": "claude-sonnet-4-6", # any catalog id
"api_key": os.environ["APISROUTER_API_KEY"],
"api_type": "openai",
"base_url": "https://api.apisrouter.com/v1",
})
researcher = AssistantAgent(name="News_Researcher", llm_config=llm_config)
analyst = AssistantAgent(name="Sentiment_Analyst", llm_config=llm_config)
advisor = AssistantAgent(name="Investment_Advisor", llm_config=llm_config)Financial analysis agents के लिए models चुनना।
चूंकि हर candidate same endpoint के against एक model string है, practical loop यह है कि अपने tickers और dates fix करें, per candidate id एक बार pipeline चलाएं, और advisor output diff करें। Per-key usage log आपके लिए हर candidate run को price करता है, जो quality-per-token argument को instinct की बजाय numbers से settle कर देता है।
- Advisor role reasoning bottleneck है। यह researcher की findings, sentiment scores, और risk picture को एक outlook में synthesize करता है, और एक frontier reasoning model (claude-opus-4-7, gpt-5.5) वह जगह है जहां यह synthesis generic होना बंद कर देता है।
- Researcher और analyst roles volume roles हैं: headlines पढ़ना, tool output structure करना, drafts score करना। claude-sonnet-4-6 या deepseek-v4-pro इन्हें हर intermediate turn पर frontier pricing के बिना sharp रखता है।
- Report analysis एक long-context workload है। एक 10-K section plus price-target context एक बड़ा prompt है, तो default मान लेने से पहले filing side पर gemini-3.1-pro-preview या claude-sonnet-4-6 test करें।
- FinGPT की जड़ें bilingual हैं। अगर आपका pipeline Chinese-language filings या news पढ़ता है, तो glm-5.2 और deepseek-v4-pro वहां natively strong हैं और same endpoint से id के through addressable हैं।
- सभी agents के लिए एक LLMConfig चलाना notebook default है, लेकिन कुछ भी आपको same base_url के against दो dicts बनाने से नहीं रोकता, advisor के लिए एक frontier वाला और readers के लिए एक fast वाला, और इन्हें per agent assign करना।
जितना उपयोग उतना भुगतान · आधिकारिक मूल्य से कम
Selected models are priced below official list prices. Exact input, output, cache, and per-request prices are shown for each model.
| मॉडल | आधिकारिक मूल्य | हमारा मूल्य |
|---|---|---|
| Claude Opus 4.7 | $5.00 / $25.00 per M | $4.00 / $20.00 per M |
| Claude Sonnet 4.6 | $3.00 / $15.00 per M | $2.40 / $12.00 per M |
| GPT-5.5 | $5.00 / $30.00 per M | $4.00 / $24.00 per M |
| DeepSeek V4 Pro | $0.43 / $0.87 per M | $0.40 / $0.90 per M |
| GLM-5.2 | $1.14 / $4.00 per M | $1.10 / $4.00 per M |
Caveats: FinGPT में हर base_url LLM नहीं है।
FinGPT एक research monorepo है, और कुछ चीज़ें बिना असल में होने के LLM endpoint settings जैसी दिखती हैं। Forecaster के market_sentiment.py में api_key और base_url parameters हैं, लेकिन ये एक market-data sentiment service configure करते हैं (ADANOS_API_KEY से पढ़ा गया), chat-completions endpoint नहीं। उस base_url को बदलना कोई भी LLM traffic route नहीं करता। FinGPT-Forecaster models खुद fine-tuned Llama weights हैं जो Hugging Face के through serve होते हैं, तो forecaster demo बिल्कुल भी एक OpenAI-compatible consumer नहीं है। Repo के अंदर नया Finogrid platform अपना LLM एक FINGPT_LLM_PROVIDER environment variable (openai, minimax, या fingpt) से चुनता है और openai provider के लिए OPENAI_API_KEY पढ़ता है। July 2026 तक इसकी example environment file provider switch और key document करती है, लेकिन कोई base-URL override variable नहीं, तो Finogrid को गेटवे के लिए out of scope मानें जब तक upstream एक document नहीं करता। आखिर में, AG2 notebook ag2[openai] को 0.11.4 या नई पर pin करता है। पुराने pyautogen 0.2-era installs same चार keys को LLMConfig class की बजाय config_list entries से configure करते हैं; keys identical हैं, तो routing काम करती है, लेकिन अपनी import style को उस AutoGen generation से match करें जो आपके पास असल में installed है।
कौन FinGPT को एक gateway के through route करता है।
- Quant researchers जो एक ticker list के across multi-agent analysis चलाते हैं। Per equity दर्जनों agent turns per-key usage visibility को per provider एक vendor dashboard से ज़्यादा useful बना देते हैं।
- Teams जो model families के across analysis quality compare करती हैं। हर candidate LLMConfig में एक model string है, एक नया provider integration और account नहीं।
- Analysts जो report pipeline के through filings को bulk में process करते हैं, जहां ids के बीच long-context pricing differences bill पर dominate करते हैं।
- Bilingual finance teams जो glm-5.2 या deepseek-v4-pro जैसी Chinese-strong ids को Claude या GPT reasoning के साथ pair करती हैं, सब एक endpoint के पीछे।
- Developers जिनके पास किसी given vendor की billing तक access नहीं है। बिना card requirement वाला top-up based access per-provider sign-up dependency हटा देता है।
Endpoint verify करें और पहली run को debug करें।
Notebook launch करने से पहले, वे models list करें जिन तक आपकी key पहुंच सकती है; LLMConfig में model string exactly एक served id से match होनी चाहिए। First-run failures की एक छोटी list है। एक 401 का मतलब है dict में api_key base_url वाले endpoint के लिए valid key नहीं है; चूंकि दोनों same dict में रहते हैं, dict print करें (key छोड़कर) और check करें कि आपने वही copy edit की जो agents को असल में मिली। एक model-not-found error एक id typo है, और /v1/models output authoritative spelling है। एक connection error आमतौर पर मतलब base_url से इसका /v1 suffix छूट गया, क्योंकि client आपके दिए base में /chat/completions append करता है। और अगर sentiment step fail होता है जबकि agent chat काम करती है, तो यह local FinBERT classifier या एक missing transformers install है, gateway नहीं। एक बार requests flow करने लगें, APIsRouter console per-request model, token counts, और spend दिखाता है। Multi-agent pipelines जल्दी calls multiply करते हैं, और usage view वह तरीका है जिससे आप देखते हैं कौन सा agent role tokens consume कर रहा है इससे पहले कि आप run को पूरे watchlist तक scale करें।
curl -s https://api.apisrouter.com/v1/models \
-H "Authorization: Bearer $APISROUTER_API_KEY" | head -50अक्सर पूछे जाने वाले प्रश्न
क्या FinGPT out of the box एक custom OpenAI-compatible endpoint support करता है?
हां, अपने API-driven pipelines में। AG2 multi-agent analysis notebook api_type "openai" plus एक base_url से LLMConfig configure करता है, और report-analysis notebook LangChain के ChatOpenAI को base_url pass करता है। दोनों upstream patterns हैं; fine-tuned local models project का एक अलग, offline आधा हिस्सा हैं।
क्या FinGPT agents इस तरह Claude या DeepSeek models पर चल सकते हैं?
हां। api_type "openai" ही रहता है और model field /v1/chat/completions पर एक plain string के तौर पर forward होती है। base_url के पीछे endpoint से serve की गई कोई भी id काम करती है, Claude, DeepSeek, GLM, और Gemini ids शामिल।
क्या AG2 pipeline के लिए मुझे अब भी OpenAI account चाहिए?
नहीं। base_url gateway पर point और api_key में gateway key होने पर, कोई request OpenAI hosts को नहीं छूती। Upstream notebook खुद एक non-OpenAI compatible endpoint से route करके यह demonstrate करता है।
क्या एक custom base_url FinGPT के market data या FinBERT sentiment scoring को affect करता है?
नहीं। yfinance quotes और FinBERT classifier बिना API keys के locally चलते हैं, और report pipeline के SEC और Financial Modeling Prep credentials अलग data keys हैं। LLM endpoint ही एकमात्र चीज़ है जो base_url move करता है।
Forecaster के market_sentiment.py में base_url parameter का क्या?
वह एक market-data sentiment service configure करता है जो ADANOS_API_KEY से authenticated है, LLM endpoint नहीं। Forecaster के अपने models Hugging Face के through serve की गई fine-tuned weights हैं, तो वहां कोई OpenAI-compatible routing लागू नहीं होती।
क्या FinGPT के अंदर Finogrid platform भी custom endpoint support करता है?
July 2026 तक documented नहीं। Finogrid FINGPT_LLM_PROVIDER से एक provider select करता है और OPENAI_API_KEY पढ़ता है, लेकिन इसकी example environment file कोई base-URL override नहीं दिखाती, तो upstream एक जोड़ने तक वहां direct vendor routing मान लें।