{"id":17442796,"url":"https://github.com/ariya/ask-llm","last_synced_at":"2025-08-08T04:14:13.775Z","repository":{"id":225206955,"uuid":"765353384","full_name":"ariya/ask-llm","owner":"ariya","description":"Interact with any LLM service","archived":false,"fork":false,"pushed_at":"2025-06-08T06:58:27.000Z","size":116,"stargazers_count":67,"open_issues_count":0,"forks_count":10,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-03T01:42:01.343Z","etag":null,"topics":["cerebras","deepinfra","deepseek","fireworks","groq","hyperbolic","jan","lepton","llama","llm","lmstudio","localai","mistral","nebius","novita","ollama","openai","openrouter","phi","together"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-29T18:56:28.000Z","updated_at":"2025-07-31T04:33:30.000Z","dependencies_parsed_at":"2024-03-12T02:38:17.261Z","dependency_job_id":"50f7eb0e-ea39-4134-8b54-43466207d655","html_url":"https://github.com/ariya/ask-llm","commit_stats":{"total_commits":77,"total_committers":1,"mean_commits":77.0,"dds":0.0,"last_synced_commit":"2acb13eff5863d77dffb29b015c3a2949abc6e60"},"previous_names":["ariya/ask-llm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ariya/ask-llm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariya%2Fask-llm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariya%2Fask-llm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariya%2Fask-llm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariya%2Fask-llm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariya","download_url":"https://codeload.github.com/ariya/ask-llm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariya%2Fask-llm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268639860,"owners_count":24282677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cerebras","deepinfra","deepseek","fireworks","groq","hyperbolic","jan","lepton","llama","llm","lmstudio","localai","mistral","nebius","novita","ollama","openai","openrouter","phi","together"],"created_at":"2024-10-17T16:33:30.150Z","updated_at":"2025-08-08T04:14:13.766Z","avatar_url":"https://github.com/ariya.png","language":"JavaScript","readme":"# Ask LLM\n\n[![asciicast](https://asciinema.org/a/646222.svg)](https://asciinema.org/a/646222)\n\nThis is a straightforward, zero-dependency CLI tool to interact with any LLM service.\n\nIt is available in several flavors:\n\n* Python version. Compatible with [CPython](https://python.org) or [PyPy](https://pypy.org),  v3.10 or higher.\n* JavaScript version. Compatible with [Node.js](https://nodejs.org) (\u003e= v18) or [Bun](https://bun.sh) (\u003e= v1.0).\n* TypeScript version. Compatible with [Deno](https://deno.com/) (\u003e= 2.0) or [Bun](https://bun.sh) (\u003e= v1.0).\n* Clojure version. Compatible with [Babashka](https://babashka.org/) (\u003e= 1.3).\n* Swift version. Compatible with [Swift](https://www.swift.org), v5.10 or higher.\n* Go version. Compatible with [Go](https://golang.org), v1.19 or higher.\n\nAsk LLM is compatible with either a cloud-based (managed) LLM service (e.g. [OpenAI GPT model](https://platform.openai.com/docs), [Groq](https://groq.com), [OpenRouter](https://openrouter.ai), etc) or with a locally hosted LLM server (e.g. [llama.cpp](https://github.com/ggerganov/llama.cpp), [LM Studio](https://lmstudio.ai), [Ollama](https://ollama.com), etc). Please continue reading for detailed instructions.\n\nInteract with the LLM with:\n```bash\n./ask-llm.py         # for Python user\n./ask-llm.js         # for Node.js user\n./ask-llm.ts         # for Deno user\n./ask-llm.clj        # for Clojure user\n./ask-llm.swift      # for Swift user\ngo run ask-llm.go    # for Go user\n```\n\nor pipe the question directly to get an immediate answer:\n```bash\necho \"Why is the sky blue?\" | ./ask-llm.py\n```\n\nor request the LLM to perform a certain task:\n```bash\necho \"Translate into German: thank you\" | ./ask-llm.py\n```\n\n## Using Local LLM Servers\n\nSupported local LLM servers include [llama.cpp](https://github.com/ggerganov/llama.cpp), [Jan](https://jan.ai), [Ollama](https://ollama.com), [Cortex](https://cortex.so), [LocalAI](https://localai.io), [LM Studio](https://lmstudio.ai), and [Msty](https://msty.app).\n\nTo utilize [llama.cpp](https://github.com/ggerganov/llama.cpp) locally with its inference engine, load a quantized model like [Llama-3.2 3B](https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF) or [Phi-3.5 Mini](https://huggingface.co/bartowski/Phi-3.5-mini-instruct-GGUF). Then set the `LLM_API_BASE_URL` environment variable:\n```bash\n/path/to/llama-server -m Llama-3.2-3B-Instruct-Q4_K_M.gguf\nexport LLM_API_BASE_URL=http://127.0.0.1:8080/v1\n```\n\nTo use [Jan](https://jan.ai) with its local API server, refer to [its documentation](https://jan.ai/docs/local-api). Load a model like [Llama-3.2 3B](https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF) or [Phi-3.5 Mini](https://huggingface.co/bartowski/Phi-3.5-mini-instruct-GGUF), and set the following environment variables:\n```bash\nexport LLM_API_BASE_URL=http://127.0.0.1:1337/v1\nexport LLM_CHAT_MODEL='llama3-8b-instruct'\n```\n\nTo use [Ollama](https://ollama.com) locally, load a model and configure the environment variable `LLM_API_BASE_URL`:\n```bash\nollama pull llama3.2\nexport LLM_API_BASE_URL=http://127.0.0.1:11434/v1\nexport LLM_CHAT_MODEL='llama3.2'\n```\n\nTo use [Cortex](https://cortex.so) local inference, pull a model (such as `llama3.2` or `phi-3.5`, among [many others](https://cortex.so/models/)) and ensure that its API server is running, and then configure these environment variables:\n```bash\nexport LLM_API_BASE_URL=http://localhost:39281/v1\nexport LLM_CHAT_MODEL='llama3.2:3b-gguf-q4-km'\n```\n\nFor [LocalAI](https://localai.io), initiate its container and adjust the environment variable `LLM_API_BASE_URL`:\n```bash\ndocker run -ti -p 8080:8080 localai/localai llama-3.2-3b-instruct:q4_k_m\nexport LLM_API_BASE_URL=http://localhost:3928/v1\n```\n\nFor [LM Studio](https://lmstudio.ai), pick a model (e.g., Llama-3.2 3B). Next, go to the Developer tab, select the model to load, and click the Start Server button. Then, set the `LLM_API_BASE_URL` environment variable, noting that the server by default runs on port `1234`:\n```bash\nexport LLM_API_BASE_URL=http://127.0.0.1:1234/v1\n```\n\nFor [Msty](https://msty.app), choose a model (e.g., Llama-3.2 3B) and ensure the local AI is running. Go to the Settings menu, under Local AI, and note the Service Endpoint (which defaults to port `10002`). Then set the `LLM_API_BASE_URL` environment variable accordingly:\n```bash\nexport LLM_API_BASE_URL=http://127.0.0.1:10002/v1\n```\n\n## Using Managed LLM Services\n\n[![Test on Cerebras](https://github.com/ariya/ask-llm/actions/workflows/test-cerebras.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-cerebras.yml)\n[![Test on DeepInfra](https://github.com/ariya/ask-llm/actions/workflows/test-deepinfra.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-deepinfra.yml)\n[![Test on DeepSeek](https://github.com/ariya/ask-llm/actions/workflows/test-deepseek.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-deepseek.yml)\n[![Test on Fireworks](https://github.com/ariya/ask-llm/actions/workflows/test-fireworks.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-fireworks.yml)\n[![Test on Glama](https://github.com/ariya/ask-llm/actions/workflows/test-glama.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-glama.yml)\n[![Test on Groq](https://github.com/ariya/ask-llm/actions/workflows/test-groq.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-groq.yml)\n[![Test on Hyperbolic](https://github.com/ariya/ask-llm/actions/workflows/test-hyperbolic.yml/badge.svg)](https://github.com/ariya//ask-llm/actions/workflows/test-hyperbolic.yml)\n[![Test on Mistral](https://github.com/ariya/ask-llm/actions/workflows/test-mistral.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-mistral.yml)\n[![Test on Nebius](https://github.com/ariya/ask-llm/actions/workflows/test-nebius.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-nebius.yml)\n[![Test on Novita](https://github.com/ariya/ask-llm/actions/workflows/test-novita.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-novita.yml)\n[![Test on OpenAI](https://github.com/ariya/ask-llm/actions/workflows/test-openai.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-openai.yml)\n[![Test on OpenRouter](https://github.com/ariya/ask-llm/actions/workflows/test-openrouter.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-openrouter.yml)\n[![Test on Together](https://github.com/ariya/ask-llm/actions/workflows/test-together.yml/badge.svg)](https://github.com/ariya/ask-llm/actions/workflows/test-together.yml)\n\nSupported LLM services include [Cerebras](https://cloud.cerebras.ai), [Deep Infra](https://deepinfra.com), [DeepSeek](https://platform.deepseek.com/), [Fireworks](https://fireworks.ai), [Glama](https://glama.ai), [Groq](https://groq.com), [Hyperbolic](https://www.hyperbolic.xyz), [Mistral](https://console.mistral.ai), [Nebius](https://studio.nebius.ai), [Novita](https://novita.ai), [OpenAI](https://platform.openai.com), [OpenRouter](https://openrouter.ai), and [Together](https://www.together.ai).\n\nFor configuration specifics, refer to the relevant section. The quality of answers can vary based on the model's performance.\n\n* [Cerebras](https://cloud.cerebras.ai)\n```bash\nexport LLM_API_BASE_URL=https://api.cerebras.ai/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"llama3.1-8b\"\n```\n\n* [Deep Infra](https://deepinfra.com)\n```bash\nexport LLM_API_BASE_URL=https://api.deepinfra.com/v1/openai\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"meta-llama/Meta-Llama-3.1-8B-Instruct\"\n```\n\n* [DeepSeek](https://platform.deepseek.com)\n```bash\nexport LLM_API_BASE_URL=https://api.deepseek.com/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"deepseek-chat\"\n```\n\n* [Fireworks](https://fireworks.ai/)\n```bash\nexport LLM_API_BASE_URL=https://api.fireworks.ai/inference/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"accounts/fireworks/models/qwen3-30b-a3b\"\n```\n\n* [Glama](https://glama.ai)\n```bash\nexport LLM_API_BASE_URL=https://glama.ai/api/gateway/openai/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL='ministral-3b-2410'\nexport LLM_STREAMING=\"no\"\n```\n\n* [Groq](https://groq.com/)\n```bash\nexport LLM_API_BASE_URL=https://api.groq.com/openai/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"llama-3.1-8b-instant\"\n```\n\n* [Hyperbolic](https://www.hyperbolic.xyz)\n```bash\nexport LLM_API_BASE_URL=https://api.hyperbolic.xyz/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"meta-llama/Meta-Llama-3.1-8B-Instruct\"\n```\n\n* [Mistral](https://console.mistral.ai)\n```bash\nexport LLM_API_BASE_URL=https://api.mistral.ai/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"mistral-small-latest\"\nexport LLM_STREAMING=\"no\"\n```\n\n* [Nebius](https://studio.nebius.ai)\n```bash\nexport LLM_API_BASE_URL=https://api.studio.nebius.ai/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"meta-llama/Meta-Llama-3.1-8B-Instruct\"\n```\n\n* [Novita](https://novita.ai)\n```bash\nexport LLM_API_BASE_URL=https://api.novita.ai/v3/openai\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"meta-llama/llama-3.1-8b-instruct\"\n```\n\n* [OpenAI](https://platform.openai.com)\n```bash\nexport LLM_API_BASE_URL=https://api.openai.com/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"gpt-4.1-nano\"\n```\n\n* [OpenRouter](https://openrouter.ai/)\n```bash\nexport LLM_API_BASE_URL=https://openrouter.ai/api/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"meta-llama/llama-3.1-8b-instruct\"\n```\n\n* [Together](https://www.together.ai/)\n```bash\nexport LLM_API_BASE_URL=https://api.together.xyz/v1\nexport LLM_API_KEY=\"yourownapikey\"\nexport LLM_CHAT_MODEL=\"meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariya%2Fask-llm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariya%2Fask-llm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariya%2Fask-llm/lists"}