curl
Call HopBase compatible endpoints with HTTP and curl.
| Model type | Protocol and endpoint | Authentication |
|---|---|---|
| GPT / Gemini / GLM | POST https://api.hop-base.com/v1/chat/completions | Authorization: Bearer |
| Claude | POST https://api.hop-base.com/v1/messages | x-api-key |
| Images | POST https://api.hop-base.com/v1/images/generations | Authorization: Bearer |
Authentication and common limits
| Item | Rule | When it is not met |
|---|---|---|
| Key header | Authorization: Bearer sk-… or x-api-key: sk-…, accepted on every endpoint; x-goog-api-key and the ?key= URL parameter are not supported | 401 missing_api_key / invalid_api_key |
| Endpoint and group | Each request must use the endpoint of its model's protocol (for example, Claude models can only be called through /v1/messages) | 404 "This API path is not supported by the current platform" |
| Model | Must be a model in one of the current key's groups | 404 model_not_found |
| Request body size | The whole body ≤ 60 MB | 413 |
GET /v1/models | Returns the model IDs available to the current key; not billed | — |
Use a model ID returned by GET /v1/models for the current plan key. A key can call only the models of the groups it includes.
Set max_tokens explicitly for Claude.
On Claude requests, omitting max_tokens does not error — it is filled in as 4096, so long output stops at 4096 tokens (stop_reason: "max_tokens"). Set it explicitly.
OpenAI protocol (GPT models)
curl https://api.hop-base.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"messages": [{"role": "user", "content": "Hello"}]
}'Anthropic protocol (Claude models)
curl https://api.hop-base.com/v1/messages \
-H "x-api-key: sk-your-key" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'Streaming (add "stream": true)
curl https://api.hop-base.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5.6-sol", "stream": true,
"messages": [{"role": "user", "content": "Hello"}]}'Next steps
- Parameter limits for each protocol are in the OpenAI SDK, Anthropic SDK, Gemini chat, and Image API pages
- When something fails, check Troubleshooting