API Reference
Base URL: https://llm-service-438759468271.europe-north1.run.app · All streaming endpoints return SSE.
// AUTH
Creates an API key and grants 50 000 free tokens. No authentication required.
| Body | {"email": "...", "name": "..."} |
| Returns | {"key": "mmk_...", "tokens": 50000, "message": "..."} |
curl -X POST https://llm-service-438759468271.europe-north1.run.app/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "name": "Your Name"}'Returns account info. Accepts Firebase ID token or an mmk_ API key.
| Returns | {"auth_type": "...", "email": "...", "tokens": 0, "is_admin": false} |
curl https://llm-service-438759468271.europe-north1.run.app/auth/me \ -H "Authorization: Bearer $MMK_API_KEY"
Links an API key to a Firebase account and merges token balances.
| Body | {"api_key": "mmk_..."} |
curl -X POST https://llm-service-438759468271.europe-north1.run.app/auth/link-key \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN" \
-H "Content-Type: application/json" \
-d '{"api_key": "mmk_..."}'// BILLING
Returns the list of available token packages.
curl https://llm-service-438759468271.europe-north1.run.app/billing/packages
Initiates a Stripe checkout session. Redirect the user to checkout_url.
| Body | {"package_id": "..."} |
| Returns | {"checkout_url": "https://checkout.stripe.com/..."} |
curl -X POST https://llm-service-438759468271.europe-north1.run.app/billing/checkout \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"package_id": "tokens_100k"}'// FILE MANAGEMENT
Uploads a file into the session context (multipart form, field name file).
| Returns | {"filename": "report.pdf"} |
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/upload \ -H "Authorization: Bearer $MMK_API_KEY" \ -F "file=@report.pdf"
Lists all files currently in the session context.
curl https://llm-service-438759468271.europe-north1.run.app/files \ -H "Authorization: Bearer $MMK_API_KEY"
Returns file content or triggers a download.
curl https://llm-service-438759468271.europe-north1.run.app/file/report.pdf \ -H "Authorization: Bearer $MMK_API_KEY" \ --output report.pdf
Deletes a file from the session context.
curl -X DELETE https://llm-service-438759468271.europe-north1.run.app/file/report.pdf \ -H "Authorization: Bearer $MMK_API_KEY"
// CHAT & ANALYSIS TOOLS
All endpoints below stream SSE. Each data: line is a progress update. [TOOL_RESULT] {…} contains the structured JSON result. [DONE] ends the stream.
# Consume an SSE stream with curl
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/asset-research \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Analyse AAPL and MSFT"}' \
--no-buffer
# Each line looks like:
# data: Fetching market data for AAPL...
# data: [TOOL_RESULT] {"aapl": {...}, "msft": {...}}
# data: [DONE]General LLM chat with file context. Optionally pass function_list to enable specific tools.
| Body | {"user_input": "...", "function_list": ["accounting_tool"]} |
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/chat \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Summarise the uploaded PDF"}' \
--no-bufferDeep iterative research with grounded web search. Returns a structured research report.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/research \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Research the impact of AI on labour markets"}' \
--no-bufferFundamental analysis for one or more tickers. Fetches market data, runs DCF, and aggregates news sentiment. Returns per-asset metrics and a comparison.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/asset-research \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Analyse AAPL and MSFT"}' \
--no-bufferPortfolio risk analysis. Accepts tickers in the message or via an uploaded CSV. Returns VaR, CVaR, Sharpe ratio, beta, and correlation matrix.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/portfolio-risk \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Risk analysis for AAPL 40%, MSFT 30%, GOOGL 30%"}' \
--no-bufferDouble-entry bookkeeping from a bank statement PDF. Returns a CSV ledger and saves accounting.xlsx to the session.
# 1. Upload the bank statement
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/upload \
-H "Authorization: Bearer $MMK_API_KEY" \
-F "file=@statement.pdf"
# 2. Run accounting
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/accounting \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Process the uploaded bank statement"}' \
--no-bufferParses an uploaded IBKR activity statement CSV. Returns trade metrics, open positions, and a Finnish tax report. Saves an Excel report to the session.
# 1. Upload the IBKR CSV
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/upload \
-H "Authorization: Bearer $MMK_API_KEY" \
-F "file=@ibkr_activity.csv"
# 2. Generate report
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/ikbr-report \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Generate IBKR report for 2024"}' \
--no-bufferGlobal market situation report: events in the last 24 h, equity indices, bond yields, currencies, and commodities for Americas, Europe, Africa, and Asia-Pacific. Returns structured JSON.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/macro-situation \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Global macro snapshot"}' \
--no-buffer