Step 1: Get your API key
- Register and log in to the HaiToken console
- Navigate to Token management in the left sidebar
- Click Create API Key, enter a name, and generate your key
- Copy and securely store the generated API key (it is shown only once)
Step 2: Call the API
HaiToken offers two API formats. Choose the one that matches the model you want to use.OpenAI format
For OpenAI-compatible models, using thePOST /v1/chat/completions protocol.
Claude format
For Anthropic Claude models, using thePOST /v1/messages protocol.
When calling the Claude format API, include the
anthropic-version header. The recommended value is 2023-06-01.Step 3: Connect to AI tools
Once you have your API key and the API is verified, you can connect HaiToken to popular AI coding tools.Cursor
- Open Cursor, go to Settings > Models
- Enter your API key in the OpenAI API Key field
- Set OpenAI Base URL to
https://api.haitoken.ai/v1 - Save and select from the available models in the model list
Claude Code
- Set environment variables in your terminal:
- Launch Claude Code to start using it.
Open Code
- Add haitoken directly from the OpenCode TUI:
- Configure provider and base URL in the
opencode.jsonfile at your project root:
Next steps
- See the API reference for complete endpoint parameters
- See Model list for available models
- See Rate limits for API call limits