Oathbreaker AI API examples

Small examples for Oathbreaker AI, a prepaid model API operated by Formacha LLC that uses the OpenAI Chat Completions format. The examples use oathbreaker-glm-5.3, the hosted GLM-5.3 Abliterated model; every model in the table below works with the same account and key. Oathbreaker operates the API gateway and billing, not the underlying model development.

API format OpenAI Chat Completions: POST https://oathbreaker.ai/v1/chat/completions
Base URL https://oathbreaker.ai/v1. The host is oathbreaker.ai, with no api. subdomain. ai.oathbreaker/oathbreaker is the MCP Registry name of the MCP server, not a hostname.
Authentication Authorization: Bearer <key>, with the key kept in OATHBREAKER_API_KEY
Models oathbreaker-glm-5.3, oathbreaker-glm-5.3-flash, oathbreaker-deepseek-v4.1-flash, oathbreaker-deepseek-v4.1-flash-fast, oathbreaker-kimi-k3.1-pro
Other formats POST /v1/responses (stateless, for Codex) and POST /v1/messages (Anthropic format, for Claude Code). These examples use Chat Completions.
Not offered Legacy Completions, embeddings, image and audio input

The JavaScript and Python examples below need no packages, and the curl request needs only curl. The C++ example uses libcurl and nlohmann/json. The SDK and framework guides each install the one package they are about.

Models

Model Context window to configure Max output
oathbreaker-glm-5.3 131,072 tokens 32,768
oathbreaker-glm-5.3-flash 131,072 tokens 32,768
oathbreaker-deepseek-v4.1-flash 32,768 tokens 32,768
oathbreaker-deepseek-v4.1-flash-fast 32,768 tokens 32,768
oathbreaker-kimi-k3.1-pro 32,768 tokens 24,576

Input and requested output share each window, and the output budget includes reasoning. The DeepSeek and Kimi models admit a request by a 131,072-unit budget of UTF-8 input bytes, message framing and requested output tokens, so 32,768 is a conservative token window for a framework to plan with. DeepSeek V4.1 Flash Fast is the same model as DeepSeek V4.1 Flash on a faster route. Prices are on the pricing page, and the model limits list the current values.

Before you start

  1. Create an account, add prepaid credit, and create an API key in your dashboard.
  2. Set OATHBREAKER_API_KEY in your server or terminal environment. Do not commit the key, put it in a client-side application, or share it in an issue.
  3. Review current pricing, API limits, privacy, and terms.

Each example makes one billable request when run with your real key. All of them use low reasoning effort and a 2,048-token output budget; reasoning shares that budget. There are no automatic retries, with one exception that the CrewAI guide describes. A timeout or incomplete answer is a reason to inspect usage before trying again, not proof that nothing was processed.

JavaScript

Requires Node.js 22 or newer; no package installation.

node javascript/hello.mjs

Python

Requires Python 3.10 or newer; uses only the standard library.

python3 python/hello.py

curl

For any language without an OpenAI SDK (C, C++, Go, Rust, shell), send the same request yourself: a POST to the full URL with two headers and a JSON body.

curl https://oathbreaker.ai/v1/chat/completions \
  -H "Authorization: Bearer $OATHBREAKER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "oathbreaker-glm-5.3", "messages": [{"role": "user", "content": "Reply with exactly: Oathbreaker connected."}], "max_tokens": 2048, "reasoning_effort": "low", "stream": false}'

C++

C++17 with libcurl and nlohmann/json. Build and install steps for Linux, macOS and Windows are in cpp/.

g++ -std=c++17 -O2 cpp/hello.cpp -o hello -lcurl
./hello

These examples print the final answer and returned token usage. The JavaScript, Python and C++ examples reject redirects and incomplete answers. They deliberately use the official HTTPS base URL and never log the API key. Keep any custom base URL trusted: the function sends its authorization header there.

SDKs and frameworks

Oathbreaker needs no SDK of its own. Anything that can call an OpenAI-style Chat Completions endpoint can be pointed at it with three values: the base URL, your key and a model name.

You use Point it at Oathbreaker with Guide and example
OpenAI SDK for Python or JavaScript OpenAI(base_url="https://oathbreaker.ai/v1", api_key=...) openai-sdk/
LangChain ChatOpenAI(base_url="https://oathbreaker.ai/v1", api_key=..., model=...) langchain/
LlamaIndex OpenAILike(api_base="https://oathbreaker.ai/v1", api_key=..., model=..., is_chat_model=True) llamaindex/
CrewAI LLM(model="openai/oathbreaker-glm-5.3", base_url="https://oathbreaker.ai/v1", api_key=...) crewai/

Each guide gives the settings, a runnable example, the request that example sends, and what to watch for with that framework. The examples send only the request fields the API reference lists, because the API rejects any other field, and they switch off the automatic retries these libraries apply by default.

Coding agents

Ready-made configs are in configs/. Each folder has the file to copy, a one-line check, the limits to know, and a link to the maintained setup guide.

Agent Config Endpoint Setup guide
Claude Code configs/claude-code/ /v1/messages oathbreaker.ai/agents/claude-code
Codex configs/codex/ /v1/responses oathbreaker.ai/agents/codex
OpenCode configs/opencode/ /v1/chat/completions oathbreaker.ai/agents/opencode
Hermes configs/hermes/ /v1/chat/completions oathbreaker.ai/agents

OpenWork and Pi are covered on the agent setup page, and HERMES.md is a short Hermes walkthrough. No Oathbreaker-specific app or GPU account is required.

Streaming and tools

The examples above are non-streaming text requests. See the API reference for streaming, function calling, preserving reasoning in tool conversations, and billing behavior. Tool calls must be validated and executed by your own application. Do not automatically replay an interrupted tool action.

Validation

node --test tests/*.test.mjs

The tests run both languages against a local fixture server and require Python 3. They check request authentication and shape, returned usage, incomplete answers, redirects, and HTTP errors without sending paid inference requests. Passing these tests does not measure live model quality or latency. The same command also checks the agent configs in configs/: base URLs, endpoints, models and limits, and that no file holds a key.

Each SDK and framework example has a test of its own, which needs that example's package installed:

python3 -m venv .venv
.venv/bin/pip install -r langchain/requirements.txt
PYTHON=.venv/bin/python node --test tests/frameworks/langchain.test.mjs

It runs the example against the same kind of local server. It fails if the request carries a field the API reference does not document, or if a failed request is sent more than once. The OpenAI SDK test also needs npm ci --prefix openai-sdk.

The C++ test builds the example first, so it needs a compiler, libcurl and nlohmann/json (see cpp/):

node --test tests/cpp/*.test.mjs

Support and contributions

For account, billing, or private security reports, use [email protected]. Public issues are suitable for example-code bugs; remove keys, account data, and private prompts before sharing. This repository contains integration examples, not the private Oathbreaker application.

Code is MIT-licensed. Oathbreaker trademarks and the hosted service are not licensed by this repository.

S
Description
Official Python, JavaScript and Hermes examples for the Oathbreaker AI prepaid model API. Operated by Formacha LLC.
Readme MIT
82 KiB
0 Stars 1 Watchers 0 Forks
Languages
JavaScript 54.4%
Python 26.3%
C++ 13%
Shell 3.9%
PowerShell 2.4%