Anthropic SDK

AkashML exposes an Anthropic-shaped Messages API over its open source model catalog. You can point any Anthropic-compatible client (including the official anthropic SDK and Claude Code) at AkashML by setting a custom base URL.

Base URL and authentication

The Anthropic-compatible endpoints are served from:

https://api.akashml.com/anthropic

Authentication uses the same Bearer-token scheme as the OpenAI-compatible API. Pass your AkashML API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Create and manage keys under Settings → API Keys.

Model IDs and the -- alias

Claude Code rejects model identifiers that contain /, so AkashML aliases slashes with -- on the Anthropic endpoints. To target an upstream model whose ID is zai-org/GLM-5.2, request the alias zai-org--GLM-5.2:

Upstream IDAnthropic-endpoint alias
zai-org/GLM-5.2zai-org--GLM-5.2
meta-llama/Llama-3.3-70B-Instructmeta-llama--Llama-3.3-70B-Instruct

The OpenAI-compatible endpoints (/v1/*) continue to accept slashed IDs unchanged.

You can list the aliased models from GET /anthropic/v1/models.

Sending a message

The Messages endpoint is POST /anthropic/v1/messages. Required fields: model, messages, and max_tokens.

curl
curl https://api.akashml.com/anthropic/v1/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org--GLM-5.2",
    "max_tokens": 256,
    "messages": [
      { "role": "user", "content": "Hello!" }
    ]
  }'

Using the official Anthropic Python SDK:

Python (anthropic SDK)
from anthropic import Anthropic

client = Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://api.akashml.com/anthropic",
)

response = client.messages.create(
    model="zai-org--GLM-5.2",
    max_tokens=256,
    messages=[
        {"role": "user", "content": "Hello!"},
    ],
)

print(response.content[0].text)

Streaming

Set stream: true to receive Server-Sent Events. The response content type switches to text/event-stream and Anthropic-shaped events are emitted:

EventPurpose
message_startInitial message envelope with id, model, role, usage.
content_block_startStart of a content block (text, tool_use, or thinking).
content_block_deltaIncremental content (text delta, input_json_delta, thinking_delta).
content_block_stopEnd of a content block.
message_deltaRunning stop_reason and usage updates.
message_stopTerminal event.
pingKeep-alive.
errorTerminal error event.

Thinking mode

Models that support extended reasoning accept a thinking block:

{
  "thinking": {
    "type": "enabled",
    "budget_tokens": 1024
  }
}

When enabled, the response includes thinking content blocks before the final text block.

Errors

All non-2xx responses use { type: "error", error: { type, message } }. Status-to-error.type mapping:

Statuserror.type
400invalid_request_error
401authentication_error
403permission_error
404not_found_error
413request_too_large
429rate_limit_error (response includes a Retry-After header)
500api_error
503 / 529overloaded_error