API
Claude Native API Integration
Instructions
The Claude series models can be accessed via the official native API. Before using, make sure to install or upgrade the anthropic dependency:
For non-Claude models, please use the OpenAI API format instead.
Endpoint: POST
/v1/messages
Usage
Request Body
Request Parameters
Name | Location | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | No | Bearer AIHUBMIX_API_KEY |
Content-Type | header | string | No | none |
body | body | object | No | none |
» model | body | string | Yes | none |
» messages | body | [object] | Yes | none |
»» role | body | string | No | none |
»» content | body | string | Yes | none |
» max_tokens | body | number | Yes | none |
Response Example
Response Results
Status Code | Status Description | Description | Data Model |
---|---|---|---|
200 | OK | none | Inline |
Using Claude in Applications (Example: Lobe-Chat)
Here’s how you can configure Claude models in a third-party application like Lobe-Chat:
- Navigate to the settings page and select Claude as your model provider.
- Enter your API Key from AiHubMix.
- Set the API proxy endpoint to:
- (Recommended) Enable the “Client Request Mode” option.
- Add your chosen model to the model list.
- It’s recommended to copy the model name from AiHubMix’s settings page and paste it in the application.