POST https://api.inference.net/v1/messages. This means you can use the Anthropic SDK to call any serverless model hosted on Inference.net, such as glm-5.2. Only your Inference API key is needed.
Requests are converted to and from the model’s native format for you. Both non-streaming and streaming responses are supported.
This page covers calling Inference-hosted models with the Anthropic SDK. To route requests to Anthropic’s own Claude models using your Anthropic API key, see the Anthropic integration instead.
Authentication
The Anthropic SDK sends itsapiKey as the x-api-key header, but the Inference API expects your key as a Bearer token in the Authorization header. Pass your Inference API key as authToken (TypeScript) or auth_token (Python), which sends Authorization: Bearer <key>. In TypeScript, also set apiKey: null so the SDK does not look for an Anthropic key.
Non-Streaming
Streaming
The Messages format requires
max_tokens. Reasoning models such as glm-5.2 spend part of the token budget on reasoning before producing text, so set max_tokens high enough for both. If the budget runs out during reasoning, the response can come back with empty content.model to the model id you want. Browse available models at inference.net/models.