대부분은 여러 LLM 회사의 모델을 직접 쓸 일이 많지 않겠지만,
회사에서 에이전트를 개발하다 보니 다양한 회사의 모델을 테스트하게 되었습니다.
그 과정에서 각 회사마다 입력 프롬프트 형식이나 메시지 규격이 제각각이라 꽤 번거로웠습니다.
멀티모달 처리나 fallback, response type, parameter 설정 같은 부분에서도 생각보다 골치 아픈 일이 많더군요.
그러다 우연히 OpenRouter를 알게 되어, 한 번 써보게 되었습니다.
저는 현재 자체 LLM Provider를 만들어서 사용 중입니다.
나름 장점도 있지만, 추가로 만들어야 하는 부분이 많아서 OpenRouter를 한 번 시험삼아 도입해봤습니다.
지금 이 글도 그 실험 과정의 일부라고 보시면 될 것 같습니다.
사용해보면서 “오, 이거 괜찮다” 싶을 수도 있고, “음… 역시 직접 만드는 게 낫겠네” 할 수도 있겠죠.
일단은 써보면서 장단점을 솔직하게 정리해보려 합니다.
일단 API Key를 먼저 생성해줍니다.
도입 여부를 고민하던 요인중 하나가, LLM 회사별로 따로따로 결제되던 비용을 통합하는것에 장점이 있을 것 같았는데, Credit limit까지 한번에 걸 수 있으니 벌써부터 마음이 좀 편하긴 합니다.
(Reset limit every... 1day, 1week, 1month 도 설정 가능합니다.)
Sort - Pricing: Low to High로 설정하면 현재 free로 사용할 수 있는 모델들도 보이네요.
맥북에서 직접 경량화된 모델 돌려볼때도 있었는데. 그러지 말고 앞으로는 여기로 호출해봐야겠습니다.
LLM 관련 텍스트 및 이미지 생성 기능은 RestAPI Url과 OpenAI SDK를 제공해 주는 것 같습니다.
요즘 주로 Typescript로 개발하고 있으므로, 앞으로는 가능하면 Typescript와 OpenAI SDK로 작업해보려고 합니다.
이번 글에서는, 간단하게 모델 리스트들만 뽑아보고 마무리 하겠습니다.
import dotenv from "dotenv";
import OpenAI from "openai";
import { writeFileSync } from "fs";
dotenv.config();
const client = new OpenAI({
baseURL: "https://openrouter.ai/api/v1",
apiKey: process.env.OPENROUTER_API_KEY,
});
async function fetch() {
try {
const models = await client.models.list();
const list = [];
for await (const model of models) {
list.push(model);
}
console.log(`Total models: ${list.length}`);
writeFileSync("models.json", JSON.stringify(list, null, 2));
console.log("Saved to models.json");
} catch (error) {
console.error("Error:", error);
throw error;
}
}
fetch();
Response 중 model Object 한개만 가져다가 구조를 좀 보겠습니다.
{
"id": "nvidia/llama-3.3-nemotron-super-49b-v1.5",
"canonical_slug": "nvidia/llama-3.3-nemotron-super-49b-v1.5",
"hugging_face_id": "nvidia/Llama-3_3-Nemotron-Super-49B-v1_5",
"name": "NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",
"created": 1760101395,
"description": "Llama-3.3-Nemotron-Super-49B-v1.5 is a 49B-parameter, English-centric reasoning/chat model derived from Meta’s Llama-3.3-70B-Instruct with a 128K context. It’s post-trained for agentic workflows (RAG, tool calling) via SFT across math, code, science, and multi-turn chat, followed by multiple RL stages; Reward-aware Preference Optimization (RPO) for alignment, RL with Verifiable Rewards (RLVR) for step-wise reasoning, and iterative DPO to refine tool-use behavior. A distillation-driven Neural Architecture Search (“Puzzle”) replaces some attention blocks and varies FFN widths to shrink memory footprint and improve throughput, enabling single-GPU (H100/H200) deployment while preserving instruction following and CoT quality.\n\nIn internal evaluations (NeMo-Skills, up to 16 runs, temp = 0.6, top_p = 0.95), the model reports strong reasoning/coding results, e.g., MATH500 pass@1 = 97.4, AIME-2024 = 87.5, AIME-2025 = 82.71, GPQA = 71.97, LiveCodeBench (24.10–25.02) = 73.58, and MMLU-Pro (CoT) = 79.53. The model targets practical inference efficiency (high tokens/s, reduced VRAM) with Transformers/vLLM support and explicit “reasoning on/off” modes (chat-first defaults, greedy recommended when disabled). Suitable for building agents, assistants, and long-context retrieval systems where balanced accuracy-to-cost and reliable tool use matter.\n",
"context_length": 131072,
"architecture": {
"modality": "text->text",
"input_modalities": [
"text"
],
"output_modalities": [
"text"
],
"tokenizer": "Llama3",
"instruct_type": null
},
"pricing": {
"prompt": "0.0000001",
"completion": "0.0000004",
"request": "0",
"image": "0",
"web_search": "0",
"internal_reasoning": "0"
},
"top_provider": {
"context_length": 131072,
"max_completion_tokens": null,
"is_moderated": false
},
"per_request_limits": null,
"supported_parameters": [
"frequency_penalty",
"include_reasoning",
"max_tokens",
"min_p",
"presence_penalty",
"reasoning",
"repetition_penalty",
"response_format",
"seed",
"stop",
"temperature",
"tool_choice",
"tools",
"top_k",
"top_p"
],
"default_parameters": null
},
일단은, Response가 규격화 되어있다는 것만으로도 만족합니다. LLM을 직접 호출하는 것 보다 비용이 저렴한 모델들도 많고요. 앞으로 여러가지 테스트를 할건데, Free 모델이 많은 것이 가장 마음에 듭니다.
아쉬운건, 이미지를 생성하는 모델들이 2개밖에 없습니다. 멀티모달 관련 기능은 기존에 사용하던 별도의 API로 호출해서 합치는 것으로 하고, 다음 글부터는 텍스트 생성 기능부터 한 번 테스트 해보겠습니다.