Migrating from Anthropic

Keep the Messages SDK and check model, thinking, and token-count differences.

Keep the Anthropic SDK and Messages request structure. Replace the URL, key, and model ID, then validate your prompts against the new model.

 client = Anthropic(
-    base_url="https://api.anthropic.com",
-    api_key=os.environ["ANTHROPIC_API_KEY"],
+    base_url="https://api.deepraxis.com/anthropic",
+    api_key=os.environ["PRAXIS_API_KEY"],
 )
-model = "claude-sonnet-4-5"
+model = "deepseek-flash"

1. Prepare

You need Python 3.10+, uv, and a Praxis key. Create one in Console → API Keys and securely inject it into the current terminal as PRAXIS_API_KEY. Never put the key in code or logs. Keep your original service configuration and key for rollback. Run the commands below in Bash on macOS or Linux.

test -n "${PRAXIS_API_KEY:-}"

Expected: exit code 0. Exit code 1 means the variable is missing; set it before continuing.

2. Choose a model

Original choicePraxis choiceCheck
An official Claude ID, such as claude-sonnet-4-5deepseek-flash for this exampleA different model, not a Claude alias; reevaluate quality and tool behavior
A Claude model is requiredCopy an available Claude ID from /anthropic/v1/modelsclaude-opus-5 appeared in the catalog on October 12, 2026; verify your required capabilities before use

The SDK base URL ends at /anthropic, without /v1: the SDK adds /v1/messages. The catalog lists models available through the Anthropic protocol. It is separate from /openai/v1/models and /google/v1beta/models.

Expected: your exact model ID is present in client.models.list(); do not carry over an official ID without checking.

Behavior differences

  • thinking supports enabled, adaptive, and disabled; output_config.effort is available. Some models cannot disable thinking and return 400 with cannot disable thinking. See Messages field support before combining options.
  • Read text blocks from content, rather than assuming the first block is text. A reasoning model can return a thinking block first.
  • count_tokens returns a calibrated estimate with x-praxis-token-count: estimated, not an exact billing measurement. See Count tokens.
  • Chat's usage.cost is the amount charged; Responses and Messages currently omit it. When X-Praxis-Generation-Id is present, use GET /model/v1/generation?id=GENERATION_ID as described in the generation record API. Records may take a few seconds to appear. If the header is absent, check Console → Usage and costs. Neither the response body's id nor X-Request-Id is a substitute for a generation ID. Missing cost does not mean zero cost.

Unsupported operations and alternatives

The compatible model API provides Messages, token counting, model listing, and file operations with the limits in the Anthropic API reference. Message Batches (/anthropic/v1/messages/batches) is not provided; send individual Messages requests with application-controlled concurrency or keep batch processing on the original service. Official model IDs and file IDs are not automatically mapped; select a catalog model and re-upload needed source files.

3. Verify one request

unset HTTP_PROXY HTTPS_PROXY ALL_PROXY http_proxy https_proxy all_proxy
uv run -q --no-project --with openai --with anthropic python - <<'PY'
import os
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.deepraxis.com/anthropic",
    api_key=os.environ["PRAXIS_API_KEY"],
    timeout=90.0,
    max_retries=0,
)
models = client.models.list()
assert "deepseek-flash" in {m.id for m in models.data}
raw = client.messages.with_raw_response.create(
    model="deepseek-flash",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Reply OK."}],
)
reply = raw.parse()
text = "".join(block.text for block in reply.content if block.type == "text")
print("HTTP", raw.status_code)
print("X-Request-Id:", raw.headers.get("x-request-id"))
print("X-Praxis-Generation-Id:", raw.headers.get("x-praxis-generation-id"))
print(text)
assert raw.status_code == 200 and text and text.strip()
assert raw.headers.get("x-request-id")
PY

Expected: exit code 0, HTTP 200, nonempty text (usually OK.), and an X-Request-Id. Assertions check both model availability and a real reply, not just connectivity. Keep the request ID for troubleshooting, never the key. The example incurs a small usage charge.

Failures

Observed errorAction
400 with cannot disable thinkingRemove the request to disable thinking, or choose a model whose catalog capabilities allow it
404 with anthropic.messages is not offered for …Choose an ID listed for the Anthropic protocol and the operation you need
404 Not Found for Message BatchesUse individual Messages calls or retain the original batch service

4. Roll back

Restore https://api.anthropic.com, the key from ANTHROPIC_API_KEY, and your original Claude model ID. Restore the original thinking options and file references. Restart the client, run your previous Messages smoke test, and retain its request ID.

Expected: the original service returns usable text. Changing configuration does not move files or previous conversation state, nor reverse charges already incurred.

API reference → · Compatibility guide →

Export

On this page