/v1/messages. You can use it exactly as you would the Anthropic API — including the anthropic-version header, the system field, and the content[] response format. Existing Anthropic SDK code works without modification.
Endpoint: POST https://api.qhaigc.net/v1/messages
You can also use
style: "claude" in the body of POST /v1/chat/completions to receive a Claude-format response from the unified endpoint. The dedicated /v1/messages path shown here is the recommended approach for Anthropic SDK compatibility.Request Headers
| Header | Required | Description |
|---|---|---|
Authorization: Bearer <YOUR_API_KEY> | Yes | Your Qhaigc API key |
anthropic-version: 2023-06-01 | Yes | Claude Messages API version identifier |
Content-Type: application/json | Yes | JSON request body |
You can also authenticate with
x-api-key: <YOUR_API_KEY> instead of the Authorization: Bearer header, matching the Anthropic SDK’s default behavior.Request Parameters
The Claude model to use. Example:
claude-opus-4-20250514, claude-sonnet-4-5.Array of conversation turns. Each object must have
role ("user" or "assistant") and content (a string or array of content blocks).Maximum number of tokens to generate in the response. This field is required by the Claude Messages API.
A system prompt that sets context and instructions for the model before the conversation begins.
Sampling temperature between
0 and 1. Lower values are more deterministic; higher values are more varied.Set to
true to receive the response as a stream of server-sent events in Claude’s streaming format.Response Fields
The Claude Messages API returns a different structure from the OpenAI format. The content is in acontent[] array of typed blocks rather than choices[].message.content.
Unique message identifier, prefixed with
msg_.Always
"message".Always
"assistant" for the model’s reply.The Claude model that generated the response.
Array of content blocks. Each block has a
type field. For standard text responses, you receive {"type": "text", "text": "..."}.Why generation ended. Common values:
"end_turn" (natural completion), "max_tokens" (hit the limit), "stop_sequence" (stop sequence matched).Token usage for this request.