FinRobot को एक custom OpenAI-compatible endpoint पर चलाएं।

Updated 2026-07-30

FinRobot अपनी LLM credentials एक AutoGen OAI_CONFIG_LIST file से पढ़ता है जिसकी entries base_url key accept करती हैं। https://api.apisrouter.com/v1 पर point करने वाली एक entry gateway key के साथ add करें, और forecaster, report-writer, और RAG agents catalog के किसी भी model id पर चल सकते हैं।

Quick answer: OAI_CONFIG_LIST में एक entry।

FinRobot की setup instructions आपसे OAI_CONFIG_LIST_sample को OAI_CONFIG_LIST में rename करने और credentials भरने को कहती हैं। वह file एक standard AutoGen config list है: एक JSON array जहां हर entry model और api_key लेती है, और optionally base_url, जो shipped sample पहले से non-default endpoints के लिए demonstrate करता है। अपनी gateway key के साथ एक entry add करें और base_url को https://api.apisrouter.com/v1 पर set करें, और file load करने वाला हर FinRobot agent इसके through route हो सकता है। एक catch जो लोगों का समय ले लेता है: tutorials autogen.config_list_from_json के through file load करते हैं एक filter_dict के साथ जो model name से entries select करता है। अगर आपकी नई entry claude-sonnet-4-6 कहती है लेकिन filter अब भी sample की GPT id मांगता है, तो आपकी entry filter हो जाती है और run पुराने credentials पर fail होती है। filter_dict को उस model से match करने के लिए update करें जो आपने add किया, या test करते समय बिना filter के चलाएं।

[
    {
        "model": "claude-sonnet-4-6",
        "api_key": "sk-YOUR-APISROUTER-KEY",
        "base_url": "https://api.apisrouter.com/v1"
    }
]

FinRobot अपनी LLM config कैसे इस्तेमाल करता है।

FinRobot (GitHub पर AI4Finance-Foundation, लगभग 7.6K stars) AutoGen (pyautogen 0.2.19 या नई) पर बना एक financial analysis के लिए AI agent platform है। इसके agents packaged workflows हैं: एक Market_Analyst forecaster जो company news और fundamentals खींचता है और अगले हफ़्ते की movement predict करता है, एक annual-report writer जो filings को एक equity research PDF में बदलता है, और earnings calls और SEC filings के ऊपर retrieval-augmented QA agents। हर tutorial same llm_config shape बनाता है: एक dict जिसका config_list OAI_CONFIG_LIST file पढ़ने वाले autogen.config_list_from_json से आता है। वह llm_config finrobot.agents.workflow के SingleAssistant और SingleAssistantShadow जैसी wrapper classes को दी जाती है, जो underlying AutoGen agents की मालिक हैं। तो endpoint decision पूरी तरह JSON file में रहता है: AutoGen का OpenAI client चुनी गई entry जो भी base_url carry करती है उस पर /v1/chat/completions requests भेजता है और model field को एक plain string के तौर पर forward करता है। वह plain string ही practical जीत है। जब base_url के पीछे का endpoint कई vendors serve करता है, एक Claude, DeepSeek, या Qwen id उसी OpenAI-shaped config से गुज़र जाती है बिना FinRobot को पता चले, और analysis model बदलना एक one-line JSON edit plus matching filter_dict बन जाता है।

पूरा setup: config file, filter, और data keys।

FinRobot credentials को दो files में बांटता है, और सिर्फ एक ही LLM से जुड़ी है। OAI_CONFIG_LIST model endpoints और keys रखती है। config_api_keys market-data credentials रखती है (FINNHUB_API_KEY, FMP_API_KEY, SEC_API_KEY, और social keys), जो register_keys_from_json से अलग load होती है। LLM को एक gateway से route करना पहली file बदलता है और दूसरी को छूता नहीं, तो news pulls, fundamentals, और filings बिल्कुल पहले जैसा behave करते हैं। नीचे वाला tutorial pattern forecaster notebook की structure है gateway entry select किए हुए। यही llm_config annual-report और RAG tutorials के लिए भी काम करता है, जो सिर्फ इसमें अलग हैं कि वे कौन सी workflow class instantiate करते हैं।

import autogen
from finrobot.utils import register_keys_from_json
from finrobot.agents.workflow import SingleAssistant

llm_config = {
    "config_list": autogen.config_list_from_json(
        "../OAI_CONFIG_LIST",
        filter_dict={"model": ["claude-sonnet-4-6"]},  # match your entry
    ),
    "timeout": 120,
    "temperature": 0,
}

register_keys_from_json("../config_api_keys")  # finnhub/fmp/sec data keys

assistant = SingleAssistant("Market_Analyst", llm_config,
                            human_input_mode="NEVER")
assistant.chat("Analyze NVDA news this week and predict next week's movement.")

Per FinRobot workflow models चुनना।

Clean experiment loop: ticker और date range fix करें, per candidate entry same workflow एक बार चलाएं, और outputs side by side compare करें। एक endpoint के पीछे हर candidate एक filter_dict edit है, और per-key usage log बिना spreadsheet work के per candidate token bill देता है।

  • Annual-report writer सबसे भारी reasoning job है: यह filing sections पढ़ता है, एक investment thesis synthesize करता है, और एक structured report draft करता है। उस workflow में claude-opus-4-7 या gpt-5.5 वह जगह है जहां output quality दिखने लायक बदलती है।
  • Market forecaster news और fundamentals पर एक छोटा, repeated task है। claude-sonnet-4-6 या deepseek-v4-pro इसे अच्छे से handle करता है, और तब matter करता है जब आप इसे रोज़ पूरे watchlist पर चलाते हैं।
  • Earnings calls पर RAG QA लंबे excerpts पर retrieval plus synthesis है, जो long-context ids को favor करती है; वहां gemini-3.1-pro-preview को claude-sonnet-4-6 के against test करने लायक है।
  • चूंकि entries filter_dict से select होती हैं, आप same base_url के against एक frontier entry और एक fast entry वाली एक file रख सकते हैं और per notebook चुन सकते हैं, per run credentials edit करने की बजाय।
  • Model ids exact strings हैं। FinRobot इन्हें बिना validate किए pass through करता है, तो endpoint की /v1/models listing authoritative spelling है।

जितना उपयोग उतना भुगतान · आधिकारिक मूल्य से कम

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.4$2.50 / $15.00 per M$2.00 / $12.00 per M
DeepSeek V4 Pro$0.43 / $0.87 per M$0.40 / $0.90 per M
Gemini 3.1 Pro Preview$2.00 / $12.00 per M$1.60 / $9.60 per M

FinRobot के लिए specific failure modes।

filter_dict mismatch सबसे बड़ा है। config_list_from_json सिर्फ वे entries return करता है जिनका model filter से match करता है; एक filter जो कुछ भी match नहीं करता एक empty config list के बारे में error raise करता है, और एक filter जो sample की बची entries से match करता है placeholder keys के साथ OpenAI को requests भेजता है, जो गलत host से एक 401 के तौर पर सामने आता है। जब routing changes effect में आते नहीं दिखें, पहले resolved config_list print करें। Relative paths दूसरी चीज़ है। Tutorials "../OAI_CONFIG_LIST" load करते हैं क्योंकि notebooks repo root से एक level नीचे बैठते हैं; root पर एक script इसकी बजाय "OAI_CONFIG_LIST" चाहती है, और AutoGen OAI_CONFIG_LIST environment variable भी accept करता है जो JSON string carry करता है, जो containers में path issues को sidestep करता है। Comment lines तीसरी चीज़ है। Setup instructions आपसे sample files से comment notes हटाने को कहती हैं क्योंकि वे JSON को invalid बना देते हैं; startup पर एक JSONDecodeError का मतलब है एक stray comment बच गया। Data credentials independently fail होते हैं। अगर agent chat तो ठीक चलती है पर news या fundamentals खाली आते हैं, तो यह एक config_api_keys problem है (Finnhub, FMP, SEC), endpoint problem नहीं। और अलग FinRobot Pro equity module अपनी keys एक config.ini से configure करता है; July 2026 तक इसकी documented settings एक openai_api_key cover करती हैं लेकिन कोई base-URL override नहीं, तो उस module को direct-vendor मानें जब तक upstream एक document नहीं करता।

कौन FinRobot को एक gateway के through route करता है।

  • Analysts जो एक coverage list के across equity reports generate करते हैं। Per report लंबे filing contexts per-model price differences को material बनाते हैं, और एक endpoint model को per-run choice बना देता है।
  • Quant teams जो एक watchlist पर रोज़ forecaster चलाती हैं, जहां एक fast mid-tier id workflow को दोबारा लिखे बिना recurring bill flat रखती है।
  • Researchers जो identical financial tasks पर model families compare करते हैं। हर candidate एक config entry है, vendor account और SDK swap नहीं।
  • Teams जो AutoGen-based stacks standardize कर रही हैं। FinRobot OAI_CONFIG_LIST convention दूसरे AutoGen projects के साथ share करता है, तो एक gateway entry format इन सबको serve करता है।
  • Developers जिनके पास किसी given vendor की billing तक access नहीं है। बिना card requirement वाला top-up based access per-provider sign-up dependency हटा देता है।

Endpoint verify करें और पहली run को debug करें।

Notebook खोलने से पहले वे models list करें जिन तक आपकी key पहुंच सकती है; OAI_CONFIG_LIST में हर model string और हर filter_dict value exactly एक served id से match होनी चाहिए। फिर SingleAssistant के through सबसे छोटी possible chat चलाएं और console देखें। एक 401 का मतलब है selected entry की api_key उसके base_url वाले endpoint की नहीं है; check करें filter ने असल में कौन सी entry चुनी। एक model-not-found error entry में एक id typo है। एक connection error का मतलब आमतौर पर base_url से इसका /v1 suffix छूट गया। अगर agent बिना tool results के loop करती है, तो config_api_keys में data keys suspects हैं, LLM endpoint नहीं। एक बार requests flow करने लगें, APIsRouter console per-request model, token counts, और spend दिखाता है। Report-writing runs लंबी multi-turn conversations हैं, और usage view दिखाता है कि एक report असल में कितने का पड़ता है इससे पहले कि आप ऐसी पचास schedule करें।

curl -s https://api.apisrouter.com/v1/models \
  -H "Authorization: Bearer $APISROUTER_API_KEY" | head -50

अक्सर पूछे जाने वाले प्रश्न

क्या FinRobot एक custom OpenAI-compatible endpoint support करता है?

हां। FinRobot AutoGen-style OAI_CONFIG_LIST entries पढ़ता है, और entries model और api_key के साथ एक base_url key accept करती हैं। base_url को gateway पर point करें, अपनी filter_dict को entry के model से match रखें, और agents इसके through route होते हैं।

क्या FinRobot agents Claude, DeepSeek, या Qwen models पर चल सकते हैं?

हां। AutoGen model field को /v1/chat/completions पर एक plain string के तौर पर forward करता है, तो endpoint जो भी id serve करता है वह काम करती है। Entry और filter_dict में model name को बस catalog id से exactly match करना है।

FinRobot मेरी नई OAI_CONFIG_LIST entry को क्यों ignore करता है?

लगभग हमेशा filter_dict। Tutorials entries को model name से filter करते हैं, तो जिस entry का model filter से match नहीं करता वह चुपचाप exclude हो जाती है। filter_dict को अपनी नई model id पर update करें, या test करते समय बिना filter के file load करें।

जब मैं LLM endpoint बदलता हूं तो क्या मेरी Finnhub, FMP, और SEC keys बदलती हैं?

नहीं। Market-data credentials config_api_keys में रहती हैं और register_keys_from_json से load होती हैं, OAI_CONFIG_LIST से पूरी तरह अलग। LLM को एक gateway से route करना data pipeline को नहीं छूता।

यह किस AutoGen version पर लागू होता है?

FinRobot pyautogen 0.2.19 या नई pin करता है और 0.2-style config_list_from_json loader इस्तेमाल करता है। Config entries में base_url key उस generation के across standard है, तो कोई FinRobot code changes नहीं चाहिए।

क्या FinRobot Pro equity module भी base_url honor करता है?

Documented नहीं। इसकी config.ini API_KEYS के तहत एक openai_api_key expose करती है लेकिन July 2026 तक कोई endpoint override नहीं। यहां बताई गई OAI_CONFIG_LIST routing main FinRobot agents और tutorials पर लागू होती है।