Home / Docs / cURL

cURL

Dependency-free examples for every endpoint — useful for debugging and CI checks.

List models

curl https://aiprimetech.io/v1/models \
  -H "Authorization: Bearer $CLAUDEAPIKEY"

Messages

curl https://aiprimetech.io/v1/messages \
  -H "x-api-key: $CLAUDEAPIKEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "system": "Be concise.",
    "messages": [{"role": "user", "content": "What is a CDN?"}]
  }'

Chat Completions

curl https://aiprimetech.io/v1/chat/completions \
  -H "Authorization: Bearer $CLAUDEAPIKEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [
      {"role": "system", "content": "Be concise."},
      {"role": "user", "content": "What is a CDN?"}
    ]
  }'

Streaming

curl -N https://aiprimetech.io/v1/messages \
  -H "x-api-key: $CLAUDEAPIKEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":512,"stream":true,
       "messages":[{"role":"user","content":"Count to five"}]}'

-N disables curl's own buffering. Without it the whole stream appears at once and streaming looks broken.

A CI health check

"c">#!/usr/bin/env bash
set -euo pipefail
code=$(curl -s -o /dev/null -w "%{http_code}" https://aiprimetech.io/v1/models \
  -H "Authorization: Bearer $CLAUDEAPIKEY")
[ "$code" = "200" ] || { echo "gateway check failed: $code" >&2; exit 1; }
echo "gateway ok"