How to use Obscurify with the OpenAI client

First, get an API key. The easiest way: sign up at obscurify.ai/signup, then press Show API Key on your account page.

From a terminal instead, one command makes the account and prints its account code and API key. The code is made on your machine and never sent:

npx -y @obscurify/cli signup

Save the account code it prints: it’s the only way to sign in. To call the sign-up endpoints yourself, see Get an API key from your account code.

Add credit on your account page with crypto or card. If you choose a blind voucher, your browser blinds it, so we can’t link the payment to your account. To redeem a voucher code over the API:

curl -X POST https://obscurify.ai/vouchers/redeem \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer sk-obs1_AbCd...' \
-d '{"vouchers": ["obv1.2000...."]}'

Signed up with a username and password? Password sign-in and old sk- tokens without obs1 are being retired. Sign in once at obscurify.ai/account to get your account code, then use the key above.

Then use the OpenAI client with your Obscurify URL and API key (Python):

client = OpenAI(
            base_url="https://obscurify.ai/v1",
            api_key="sk-obs1_AbCd...",
        )
        completion = client.chat.completions.create(
            model="anthropic/claude-sonnet-4.5",
            messages=[
                {
                    "role": "system",
                    "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.",
                },
                {
                    "role": "user",
                    "content": "Compose a poem that explains the concept of recursion in programming.",
                },
            ],
        )

        print(completion.choices[0].message.content)

Response:

ChatCompletionMessage(content="In the realm of code, a concept lies\nRecursion, a trick that's rather wise\nA function that calls itself with pride\nUntil a base case is satisfied\n\nLike Russian dolls that nest inside\nEach one contains a smaller size\nRecursion works in similar ways\nSolving problems in elegant phase\n\nImagine a tree with branches grand\nEach branch divides, like a fractal's hand\nRecursion traverses every part\nFrom leaf to root, it plays its art\n\nFibonacci's sequence, a classic case\nRecursion shines in this number chase\nEach term, the sum of two before\nIt builds the sequence, forever more\n\nBut be cautious, dear programmer's mind\nLest infinite loops leave you in a bind\nEnsure a base case, a stopping point\nOr else, recursion will disappoint\n\nSo when complex problems come to play\nAnd iteration just won't make the grade\nThink recursion, with its clever might\nA powerful tool, in the coder's sight\n\nRecursion, a concept that's deep and vast\nIn programming's world, it's unsurpassed\nA elegant way to break things down\nAnd solve the puzzles that come", role='assistant', function_call=None, tool_calls=None)