EN ▾
Open account

How to Swap Your Claude API Key for Ours

Replacing your Claude API key with a key for an uncensored, OpenAI-compatible endpoint takes about ten minutes when the code already uses the chat completions format. This guide walks through the new key, the base URL, a test request, streaming, tools, costs and the errors you will see while switching.

Last updated

Summary

  • The switch needs a new key and a new base URL; the request format stays the same.
  • Run one test request on the model id uncensored before you move any production traffic.
  • Costs are $0.15 per 1M input tokens and $0.50 per 1M output tokens, billed from prepaid credit.
  • Keep the old key in configuration until the new one has run cleanly for a few days.

Why Developers Are Switching Their Key to an Uncensored Endpoint

Some lawful workloads run into refusals on a standard assistant, for example adult fiction, blunt medical questions or security research. An uncensored endpoint answers those requests directly, and the only hard limit is sexual content involving minors.

Decide in advance which requests your product accepts, because the model will not make that decision for you.

Step 1: Retrieve Your New Uncensored API Key

Sign up with Google or with an email and a password on the Get API key page. The key appears on screen once. The account starts with $0.50 of trial credit, valid for 7 days, and no card is needed.

  • Store the key in an environment variable, never in client code.
  • Rotate the key at any time; the old one stops working at once.

Step 2: Update Your Base URL in the Code

Set the base URL to https://mistralgetapikey.com/v1 and pass the new key in the Authorization header as a bearer token. Keep the base URL in configuration so that you can change it without a deploy.

Leave the rest of the client as it is. Messages, roles and the response parser all stay the same.

Step 3: Verify the Switch with a Test Request

Send one short request with the model id uncensored. A reply with a usage block confirms the key, the base URL and the model id together.

If the call fails, read the status code first. A 401 means the key is wrong, and a 402 means the credit is used up.

Handling Streaming Responses in Your Existing Code

Set stream: true if your product already streams. Each server-sent event carries a piece of the answer, and the last event carries the usage numbers.

Test the stream on a slow connection too, because a dropped stream should end with a clear error message in the interface and not a half-written reply.

Function Calling Compatibility Check

If your app uses tools, define one function with a JSON schema and let the model call it. Return a result, then check that the final answer uses it correctly.

  1. Test a tool with two required arguments.
  2. Test two tools called in sequence.
  3. Validate the arguments before you act on them.

Monitoring Token Usage and Costs

Store the input and output token counts from each response together with the request id. Multiply them by $0.15 and $0.50 per 1M tokens to get the cost of each call.

WorkloadInput tokensOutput tokensCost
Short chat turn1,000400$0.0003
Long document summary80,0002,000$0.0130

Troubleshooting Common Connection Errors

Most switch problems come from three causes: a key with extra spaces or a line break, a base URL that still points to the old service, or a missing /v1 at the end of the URL.

Each key allows 300 requests per minute and 8 requests at the same time. A 429 means slow down, and a retry with backoff fixes it.

Final Verification and Going Live

Run both endpoints on the same prompts for a few days and compare the answers, the latency and the cost. Move traffic in steps, watch the error rate after each step and keep the old key in configuration until the new one has run cleanly.

When the numbers match your expectations, remove the old key from the environment and from the code review checklist.

Frequently asked questions

Will my existing code work after the switch?

In most cases yes. The endpoint uses the chat completions format, so only the base URL and the key change.

Which model id do I send?

Send uncensored. It is the only model on the service, so the id does not change.

Is there a free way to test?

Yes. A new account gets $0.50 of trial credit, valid for 7 days, and no card is needed to start.

How do I add money to the balance?

Pay with USDT on TRC20 or USDC on Base, starting at $20. Bonus credit applies from $50 and the credit never expires.

Get your API key

Sign up, grab the key, update the base URL. Simple.