{"slug": "stop-managing-six-ai-vendor-accounts-one-key-for-109-models", "title": "Stop managing six AI vendor accounts: one key for 109 models", "summary": "A developer built and operates LiuRun API, an OpenAI-compatible gateway that provides a single API key and endpoint for 109 models across vendors including Claude, GPT, Gemini, DeepSeek and Grok. The service, running on the open-source New API project, requires only a base_url and api_key swap in the existing OpenAI or Anthropic SDK, logs per-request token counts and dollar costs from a published per-model price table, and uses prepaid USD billing with no subscription or minimum.", "body_md": "If your code already uses the OpenAI SDK, a gateway that speaks the OpenAI wire format requires exactly two changes:\n\n``` python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.liurun.click/v1\",   # was \"https://api.openai.com/v1\"\n    api_key=\"sk-your-liurun-key\",             # was your OpenAI key\n)\n\nresp = client.chat.completions.create(\n    model=\"claude-sonnet-5\",                  # any of 109 models, same call shape\n    messages=[{\"role\": \"user\", \"content\": \"Explain WAL in Postgres\"}],\n)\nprint(resp.choices[0].message.content)\n```\n\nThat `model` string is now the only knob between vendors. A fallback chain becomes a list, not a architecture project:\n\n```\nMODELS = [\"claude-sonnet-5\", \"gpt-5.5\", \"deepseek-chat\"]  # try in order\ncurl https://api.liurun.click/v1/chat/completions \\\n  -H \"Authorization: Bearer sk-your-liurun-key\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gemini-2.5-flash\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Say hi in 3 words\"}],\n    \"stream\": true\n  }'\n```\n\nStreaming is standard SSE — `data:` lines, `data: [DONE]` sentinel, nothing exotic.\n\nThe gateway also accepts the Claude-format `/v1/messages` endpoint. So the Anthropic SDK works with a base URL swap:\n\n``` python\nimport anthropic\n\nclient = anthropic.Anthropic(\n    base_url=\"https://api.liurun.click\",\n    api_key=\"sk-your-liurun-key\",\n)\n\nmsg = client.messages.create(\n    model=\"claude-sonnet-5\",\n    max_tokens=1024,\n    messages=[{\"role\": \"user\", \"content\": \"Hello, Claude\"}],\n)\n```\n\nEvery request gets logged with its exact token counts and its exact cost. Not \"credits\" — dollars and cents, computed from a per-model price table that's published in full on a public pricing page:\n\n| Model | Input $/1M | Output $/1M | \n|---|---|---|\n| Claude Sonnet 5 | 1.45 | 7.27 | \n| Claude Opus 4.6 | 3.63 | 18.16 | \n| GPT-5.5 | 2.72 | 16.35 | \n| Gemini 2.5 Flash | 0.16 | 1.36 | \n| DeepSeek Chat | 0.36 | 1.45 | \n| Grok 4.5 | 1.09 | 3.27 | \n| GPT-6 Luna (budget) | 0.05 | 0.27 | \n\nPrompt-cache reads on Claude models bill at 10% of the input rate — cache-friendly agents stop being a budget gamble. Image models bill per image (GPT-Image-2 ≈ $0.051/image).\n\nBilling is prepaid: you top up a USD balance from $1 and usage draws it down. No subscription, no seats, no minimum. If you stop liking the service, your remaining balance is the only thing at risk — and there's no contract to cancel.\n\nThe pattern I use in my own projects now:\n\n``` python\ndef complete(messages, *, tier=\"smart\", **kw):\n    models = {\n        \"smart\":  [\"claude-sonnet-5\", \"gpt-5.5\"],\n        \"cheap\":  [\"gemini-2.5-flash\", \"deepseek-chat\"],\n        \"budget\": [\"gpt-6-luna\"],\n    }[tier]\n    last = None\n    for m in models:\n        try:\n            return client.chat.completions.create(\n                model=m, messages=messages, **kw)\n        except Exception as e:\n            last = e\n    raise last\n```\n\nSame key, same endpoint, model choice becomes a cost/quality dial instead of an integration decision.\n\nThe gateway runs on [New API](https://github.com/QuantumNous/new-api), which is open source — if you'd rather keep everything in-house, the two-line migration above works against your own deployment too. I self-host the hosted version on a small AWS instance in Tokyo behind CloudFront; a t4g.small handles it comfortably.\n\n**Links:** [Sign up](https://api.liurun.click/register) · [Pricing](https://api.liurun.click/pricing) · [User Agreement](https://api.liurun.click/user-agreement)\n\n*(Disclosure: I built and operate LiuRun API. The migration pattern above applies to any OpenAI-compatible gateway, self-hosted included.)*", "url": "https://wpnews.pro/news/stop-managing-six-ai-vendor-accounts-one-key-for-109-models", "canonical_source": "https://dev.to/2048lr/stop-managing-six-ai-vendor-accounts-one-key-for-109-models-194a", "published_at": "2026-10-06 06:12:09+00:00", "updated_at": "2026-10-06 06:18:07.104853+00:00", "lang": "en", "topics": ["ai-infrastructure", "developer-tools", "ai-tools", "large-language-models"], "entities": ["LiuRun API", "New API", "OpenAI", "Anthropic", "Claude Sonnet 5", "GPT-5.5", "Gemini 2.5 Flash", "AWS"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/stop-managing-six-ai-vendor-accounts-one-key-for-109-models", "markdown": "https://wpnews.pro/news/stop-managing-six-ai-vendor-accounts-one-key-for-109-models.md", "text": "https://wpnews.pro/news/stop-managing-six-ai-vendor-accounts-one-key-for-109-models.txt", "jsonld": "https://wpnews.pro/news/stop-managing-six-ai-vendor-accounts-one-key-for-109-models.jsonld"}}