API guide

Shredz speaks the OpenAI API. Point an OpenAI SDK or app at the base URL, use a Shredz key, and pick a model.

Get a key

A key is the whole account. One click makes it. There is no form to fill in.

A key starts with sk-sz- and is 49 characters long. The server stores only a hash of it and cannot give it back to you, so save it. Then add credit with Monero: a key with no credit answers 402.

Base URL and key

Send the key with every request in the Authorization header.

Apps that send the key as x-api-key work too. The API sends open CORS headers, so a web page can call it directly.

Chat completions

POST /v1/chat/completions takes the same body as OpenAI's endpoint and answers in the same shape. model and messages are required. The model ids are on the models page.

The answer is the model's, with two fields added to usage: cost is what this request took from your key, in dollars, and balance is the credit left after it.

Streaming

Set "stream": true and the answer arrives piece by piece as server-sent events, in OpenAI's chunk format.

Shredz always asks the provider for a usage chunk at the end, whether you set stream_options or not. It is the last chunk before data: [DONE] and carries usage with cost and balance.

Tools and images

Everything else in the body goes to the model as you sent it: temperature, max_tokens, tools and tool_choice, response_format and the rest. Shredz does not check these. Whether one works depends on the model. If the model refuses the request, you get its message back with the code provider_rejected.

An image goes in as an image_url part, as a link or as a base64 data URL. Use a model that reads images. A request can be up to 12 MB.

Models

GET /v1/models lists every model with its price. It needs no key.

Each entry has OpenAI's fields plus the ones you need to choose a model and to work out a budget.

pricing.prompt and pricing.completion are dollars per token. input_per_million and output_per_million are the same prices per 1 million tokens. The markup is already in them. GET /v1/models/{id} returns one entry. Shredz reads the list from the provider again every ten minutes.

Balance

GET /v1/balance says what is on the key.

balance is the credit left. spent is everything the key has paid for so far. Both are US dollars.

What a request costs

The charge for a request is what it cost at the provider plus 10%, rounded up to the next millionth of a dollar ($0.000001). Normally the provider reports the cost itself. When it does not, the charge is its token count times the prices on the models page.

Every answer says what it cost: usage.cost is the dollars charged for this request, usage.balance is the credit left. In a stream both are in the last chunk.

Before a request starts

Shredz estimates the size of the prompt (one token per three characters, 1,200 tokens per image or file) to check that the credit covers it. If it does not, you get 402 and nothing is sent to the model. The charge itself comes from the provider's count, not from this estimate.

When the credit runs short

Shredz works out the longest answer the credit can pay for and lowers max_tokens to that. The answer then stops there with finish_reason: "length". The estimate is rough, so a key can end a tiny amount below zero. It then answers 402 until you add credit.

When you hang up

If you close the connection in the middle of a stream, Shredz drops its connection to the provider. You are charged for the prompt and for the text sent up to that moment, by estimate: one token per three characters. Closing the connection while you wait for an answer that is not a stream costs nothing.

When a request fails

A request that fails before the model has sent anything is not charged. That is true for every error in the table below. If a stream breaks after text has arrived, the text that arrived is charged by the same estimate.

Limits

At most 4 requests run at the same time on one key. One more gets 429 with the code too_many_parallel. A running request holds the credit it might need, so two requests cannot spend the same credit.

Shredz sets no limit per minute. When a model is busy at the provider, you get 429 with the code rate_limited.

There are three endpoints: chat completions, models and balance. Embeddings, image generation, audio and the Responses API are not offered, and those paths answer 404.

What is removed

Before your request goes to the provider, Shredz deletes the fields that could tell one caller from another: user, metadata, session_id, safety_identifier, prompt_cache_key and store. Your key is not passed on either. The request goes out from Shredz's own account.

The messages are passed on unchanged. Shredz does not store or log them; the privacy page has the details. On the way back, system_fingerprint and the provider's own billing fields are taken out, and model is set to the id you asked for.

Errors

Errors come in OpenAI's shape, with a message in plain words.

Statuserror.codeMeaning
400bad_jsonThe body is not valid JSON.
400bad_requestThe body is not a JSON object.
400model_requiredmodel is missing.
400messages_requiredmessages is missing or empty.
401invalid_api_keyNo key was sent, or there is no such key.
402insufficient_balanceThe credit on the key does not cover this request. Add Monero.
404model_not_foundThere is no model with that id.
404not_foundThere is no such endpoint.
413too_largeThe body is larger than 12 MB.
429too_many_parallel4 requests are already running on this key.
429rate_limitedThe model is busy at the provider. Try again in a moment.
4xxprovider_rejectedThe model refused the request, for example a parameter it does not accept. The status and the message are the provider's.
500server_errorSomething went wrong at Shredz.
502provider_unreachableThe provider did not answer.
502provider_errorThe provider failed, or its answer could not be read.
503provider_unavailableShredz's own account at the provider has a problem. It is ours to fix.
503not_openShredz is not open yet.

None of these is charged, so rate_limited and the two 502 errors are safe to try again.

Use it in other apps

Any app that lets you set a custom OpenAI base URL can use Shredz. Open WebUI, SillyTavern, LibreChat, Cline and Continue are apps of that kind. We have not tested each of them. The settings are always the same three.

SettingWhat to enter
Base URL/v1
API keyYour Shredz key
ModelAn id from the models page, for example z-ai/glm-5.3. An app that loads the list itself gets it from /v1/models.

Some apps call the base URL "API host" or "endpoint". If the app has a list of providers, pick the one named "OpenAI-compatible" or "custom", the one that lets you change the base URL. An app that also wants embeddings, image generation or speech from the same key gets 404 for those.