ikarpov

ikarpov

Osmotic sits between your organisation and the model providers. It issues
API keys to people, teams, and applications, enforces token and USD
quotas, scans outbound requests for secrets, and records what every
request cost and who it belongs to. Keys carry attribution — person, team,
department, application — so cost reports survive re-organisations.
Phoenix + PostgreSQL, BSD 2-Clause, shipped as .deb packages — no
Erlang or Elixir on the host required.

Scope: Anthropic (Messages API + batch) and OpenAI (Responses API +
batch), each a native passthrough on its own listener and hostname, in
the provider’s own wire protocol. There is deliberately no unified
request schema — a parameter the abstraction does not model is a
parameter the client cannot use. Not in the box: Chat Completions,
Embeddings, Realtime, images, audio, fine-tuning; Google is on the
roadmap.

For Claude Code, adoption is one environment variable:

export ANTHROPIC_BASE_URL=https://gateway.example.com
export ANTHROPIC_API_KEY=pxy_…   # issued by the admin console

For the Codex CLI, a model_providers entry pointed at the OpenAI
hostname with wire_api = "responses". One proxy key works on either
hostname — a key identifies a person, not a provider.

The parts where Elixir did the heavy lifting:

  • SSE frames are relayed as they arrive, byte-for-byte, no buffering.
    Usage is parsed out of the stream — never from a buffered body — and
    priced against an effective-dated rate card (including OpenAI’s
    service and context tiers), so a price change never rewrites history.
  • Quotas run in alert or enforce mode; over an enforced cap the gateway
    answers 429 with Retry-After pointing at the billing-period rollover.
    One-off grants raise a cap for the current period and expire at
    rollover on their own.
  • The DLP scanner is ReDoS-bounded and fails closed: if the pattern
    cache is unavailable, the request is refused, never silently
    forwarded.
  • A daily job reconciles the gateway’s totals against both providers’
    cost APIs — Anthropic’s Cost Admin API and OpenAI’s organization Costs
    API — with age-aware drift classification, because provider figures
    get revised.

On method. I have not written production code by hand in years — the
career went technician → programmer → sysadmin → security officer →
DevOps/SRE → architect. The decisions in Osmotic are mine; the
implementation is Claude’s, held to CI gates (formatter, Credo, Sobelow,
gitleaks, tests) and verified against real provider billing. Questions
welcome — including the ones where I’ll have to read my own codebase
before answering.

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New
kip
Following on from my CLDR lbraries I started work on Unicode transforms. But like everything related to CLDR there is a lot of yak-shavin...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews