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

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews