API & Docs
Base URL: https://llm-service-438759468271.europe-north1.run.app
// What is this
This is a set of AI tools I've built that I use personally and have made available as an API. The tools cover things like asset research, portfolio risk analysis, accounting, global macro situation reports, quarterly earnings comparisons, and document translation. They can be used through the chat interface in the browser, or programmatically via the REST API documented below. I develop existing ones and release new ones at an irregular pace. Use at your own risk, I give no guarantees on the results. If you purchased tokens and got garbage results please email me the details and I can give a refund.
All endpoints that produce substantial output stream their results as Server-Sent Events (SSE). Each data: line is a progress update or result chunk. A data: [TOOL_RESULT] {…} line contains the structured JSON result. The stream ends with data: [DONE].
# Example: stream a tool result with curl
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/asset-correlations \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Analyse PATH"}' \
--no-buffer
# data: Fetching market data for PATH...
# data: Running DCF analysis...
# data: [TOOL_RESULT] {"path": {"price": 11.72, ...}}
# data: [DONE]// Getting started
There are two ways to get access — the chat interface (no coding required) or the API. Both use the same token balance.
Option A — Chat interface
- Go to mmkki.com/chat
- Sign in with Google — you get 50,000 free tokens automatically
- Select a tool from the menu, upload files if needed, and send your prompt
- Buy more tokens at mmkki.com/account if you run out
Option B — API key
- Register for an API key with
POST /auth/register(see Auth section below) - You receive an
mmk_…key and 50,000 free tokens - Pass the key as
Authorization: Bearer mmk_…on every request - Buy more tokens via
POST /billing/checkoutor at mmkki.com/account
If you already have both a Firebase (Google sign-in) account and an API key, use POST /auth/link-key to merge the balances into one account.
// Tokens & pricing
Billing is metered per request, from what the request actually did. Every model call it makes — including the calls a tool makes internally — is measured, along with any grounded web searches, and you are charged for that measured work. Nothing is estimated and there are no fixed per-tool surcharges.
Because of that, the same tool can cost different amounts on different runs, and different tools cost very different amounts, depending on how many internal model calls and web searches the work required. A tool that searches the web several times and then synthesises a long report costs far more than one that reads a file you uploaded and writes a short summary. Your usage history records what each request actually cost rather than an estimate.
| Package | Tokens | Price |
| Starter | 100,000 | $2 |
| Standard | 500,000 | $8 |
| Pro | 2,000,000 | $25 |
What drives the cost — two things, measured per request:
| Model work | The input and output of every model call the request makes |
| Grounded web search | Each web search performed — the bigger factor for research tools |
As a rough guide: plain chat and the tools that only read a file you uploaded (accounting, IBKR report, quarterly comparison) are the cheapest, because they do no web search. Tools that search — asset correlations, macro situation, market research, deep asset research — cost more or less in proportion to how many searches the run needs, and the investment finder searches the most of any tool. Long documents cost more than short ones, so a book-length translation is billed accordingly.
// 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 and current token balance. Accepts either a 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 existing API key to a Firebase (Google) account and merges the token balances. Use this if you registered an API key separately and later signed in with Google.
| 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
Payments are handled by Stripe. The checkout flow redirects to a Stripe-hosted page — no card data touches the API server. Tokens are credited instantly after payment.
Returns the available token packages with prices.
curl https://llm-service-438759468271.europe-north1.run.app/billing/packages
Creates a Stripe checkout session. Redirect the user to the returned checkout_url. Tokens are credited automatically via webhook after payment.
| Body | {"package_id": "starter" | "standard" | "pro"} |
| 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": "starter"}'// File management
Files uploaded to the session are available to all tool endpoints as context. Each user has their own isolated file directory on the server. Upload a PDF, CSV, DOCX, or TXT before calling a tool that needs it.
Uploads a file into the session. Use multipart form data with 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.
curl https://llm-service-438759468271.europe-north1.run.app/files \ -H "Authorization: Bearer $MMK_API_KEY"
Returns file content. Text files are returned as {"filename":"...","content":"..."} JSON. Binary files (PDF, Excel, etc.) stream as raw bytes.
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.
curl -X DELETE https://llm-service-438759468271.europe-north1.run.app/file/report.pdf \ -H "Authorization: Bearer $MMK_API_KEY"
// Chat
General LLM chat with awareness of uploaded files. Optionally pass function_list to activate specific tools within the same conversation turn.
| Body | {"user_input": "...", "function_list": ["research"]} |
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-buffer// Research tools
All research endpoints stream SSE progress lines and end with a [TOOL_RESULT] JSON event followed by [DONE]. Tool outputs are also saved as files in the session and can be retrieved via GET /file/{{filename}}.
Iterative grounded web research across multiple search rounds. Returns a structured research report saved as a Markdown file. Good for broad questions that benefit from synthesising many sources.
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-bufferCorrelation and relative-performance analysis across two or more assets. Returns a correlation matrix of daily returns, a pairwise table flagging redundant vs diversifying pairs, each asset's return against its own sector ETF and the broad market, and grounded segment/single-name news with a read on whether news on one name moved its correlated peers. Also writes a markdown report and a normalised price chart (all assets rebased to 100) to your file directory.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/asset-correlations \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "how correlated are NVDA, AMD and INTC over the past year"}' \
--no-bufferExtended equity research for a single ticker. Pulls annual and quarterly financials, balance sheet, cash flow, and institutional holders from yfinance, then runs three parallel grounded research passes (recent performance, industry/competition, history and future). Synthesises all of this into a six-section research article (current situation, valuation drivers, balance sheet analysis, future outlook, history, industry and competition) with pre-computed markdown tables. Saves a .md file to the session.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/deep-asset-research \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Deep research on PATH"}' \
--no-bufferPortfolio risk analysis for a set of tickers and weights. Returns VaR, CVaR, Sharpe ratio, beta, max drawdown, and a correlation matrix. Tickers and weights can be provided in the prompt or via an uploaded CSV.
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-buffer24-hour global market situation report. Covers key events, equity index prices and changes, government bond yields, FX rates, and commodity prices for Americas, Europe, Africa, and Asia-Pacific. No input required. Returns structured JSON and saves a Markdown report to the session.
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": ""}' \
--no-bufferScreens US equities for asymmetric opportunities — cases where market sentiment looks overly pessimistic relative to defensible fundamentals. Give an investment thesis in user_input (e.g. "automation companies will benefit from AI"), or leave it vague/empty to screen for general turnaround candidates. Mention any tickers you have already researched and they will be excluded — or upload a text file (named e.g. researched.txt, portfolio.csv, or anything containing "exclude", "holdings", "watchlist", etc.) with one ticker per line, and its tickers are excluded automatically. The tool builds a candidate universe via grounded search, scores each on price position in its 52-week range, P/S, net cash, and market pessimism (short interest + analyst consensus), then runs a grounded "why is the market bearish?" check on the top candidates and evaluates each against your thesis. Returns the top 4 with full write-ups plus a table of all screened candidates, saved as a Markdown file.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/investment-finder \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Automation firms will benefit from AI. Already researched PATH, ROOT."}' \
--no-bufferWhat is genuinely new for one asset, and nothing else — no valuation model, no long-term thesis, no analyst targets. The timeframe is detected from your wording (today, past week, past month, past quarter, past year; defaults to a week). Covers the price move over that window, company and sector news, and notable retail/social sentiment. The current price is anchored from market data rather than from search results, so it cannot be confused with a 52-week extreme or a stale quote. Returns a short summary plus the price anchor.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/asset-developments \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "What happened with Nvidia (NVDA) over the past week?"}' \
--no-bufferRetrieval over the published market-research posts. A vague or empty query returns an overview of every covered asset and its central thesis. A specific query — a ticker, a company, or a direct question — finds the relevant post(s), supplements them with a live grounded web search for current data, and answers with both, so you get the original thesis alongside what has changed since.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/market-research \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "What is the thesis on UiPath and does it still hold?"}' \
--no-bufferRaw daily price history — plain JSON, no LLM involved and no tokens charged. Useful when you want to run your own analysis locally but would rather not hit market-data rate limits from your own IP. Accepts up to 25 tickers. Returns {ticker: {date: value}}; a ticker that could not be fetched comes back with an error key instead of a series.
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/market-data \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"tickers": ["^GSPC", "NVDA"], "start": "2026-01-01",
"end": "2026-07-01", "interval": "1d", "field": "Close"}'// Document tools
These tools operate on uploaded files. Upload the document(s) first via POST /api/v1/upload, then call the tool endpoint.
Processes an uploaded bank statement PDF into a double-entry bookkeeping ledger. Returns a categorised CSV and saves an accounting.xlsx Excel file to the session.
# 1. Upload
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. Process
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, realised P&L, open positions, and a Finnish tax summary. Saves an Excel report to the session.
# 1. Upload
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-bufferCompares uploaded quarterly earnings reports (PDF, TXT, DOCX). Works with any number of quarters — detects which quarter each file covers, sorts them chronologically, and produces: revenue/EPS/margin/cash flow tables with QoQ and YoY growth, historical guidance accuracy analysis, a beat-adjusted next-quarter forecast, and sentiment evolution across quarters. Saves a Markdown report and a JSON context file to the session.
# 1. Upload all quarterly reports
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/upload \
-H "Authorization: Bearer $MMK_API_KEY" \
-F "file=@q1_2026.pdf"
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/upload \
-H "Authorization: Bearer $MMK_API_KEY" \
-F "file=@q2_2026.pdf"
# 2. Compare
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/quarterly-comparison \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "Compare the quarterly reports"}' \
--no-bufferRolling translation of an uploaded document (PDF, TXT, DOCX, MD) into any language. Specify the target language in user_input. Splits the document into ~700-word paragraph-boundary chunks and translates each with a continuously updated context that tracks author tone, writing style, and a growing glossary of established term translations. Saves the complete translation as a Markdown file and the translation context as JSON to the session.
| user_input | Must include the target language, e.g. "translate to Finnish" |
# 1. Upload document
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/upload \
-H "Authorization: Bearer $MMK_API_KEY" \
-F "file=@article.pdf"
# 2. Translate
curl -X POST https://llm-service-438759468271.europe-north1.run.app/api/v1/translation \
-H "Authorization: Bearer $MMK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_input": "translate to Finnish"}' \
--no-buffer// Session utilities
Returns the full result of the most recently completed tool as a string. Use this after a streaming call to retrieve the complete structured output without parsing SSE.
curl https://llm-service-438759468271.europe-north1.run.app/code_block \ -H "Authorization: Bearer $MMK_API_KEY"
Clears the session context (conversation history and file references). Files on disk are not deleted — use DELETE /file/{{filename}} for that.
curl https://llm-service-438759468271.europe-north1.run.app/flush \ -H "Authorization: Bearer $MMK_API_KEY"