Docs

Quickstart

curl quickstart

No package at all: the API is plain HTTPS and JSON. These work from any terminal, and translate directly to any HTTP client.

1. Set the key and send one request

chat - curl
export SILICON_API_KEY=sn_live_... curl https://api.siliconnetwork.io/v1/chat/completions \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "llama-3.2-3b",    "messages": [{"role": "user", "content": "Say hello in one line."}]  }'

Create the key on the API Keys page. The answer is an OpenAI chat completion; the text is in choices[0].message.content. Add -i to see the gateway's headers: Silicon-Request-Id, Silicon-Model, Silicon-Node and the rate-limit budget.

2. Stream the answer

stream - curl
curl -N https://api.siliconnetwork.io/v1/chat/completions \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "llama-3.2-3b",    "stream": true,    "messages": [{"role": "user", "content": "Write a haiku about silicon."}]  }'

-N turns off curl's buffering. The answer is server sent events: one data: line per chunk, each with choices[0].delta.content, ending with data: [DONE].

3. List the models

models - curl
curl https://api.siliconnetwork.io/v1/models \  -H "Authorization: Bearer $SILICON_API_KEY"

The list is what the network is serving now, with each model's aliases. Any id or alias in it works as model.

4. Read an error

errors - curl
status=$(curl -sS -o response.json -w "%{http_code}" https://api.siliconnetwork.io/v1/chat/completions \  -H "Authorization: Bearer $SILICON_API_KEY" \  -H "Content-Type: application/json" \  -d '{"model": "llama-3.2-3b", "messages": [{"role": "user", "content": "Hi"}]}') if [ "$status" = "200" ]; then  cat response.jsonelse  echo "HTTP $status"  cat response.json   # the message, and Silicon-Request-Id is in the headers (-i)fi
Statuses worth handling
StatusMeaning
401No key, or a revoked or unknown one.
402Insufficient credits, or a spend cap reached. Add balance or raise the cap.
403The key may not use this model, route or IP.
429Rate limited. Wait the Retry-After seconds, then retry.
5xxThe gateway or the serving node failed. 502, 503 and 504 are refused before any work is done or billed, so retrying them is safe.

Next: Streaming, Headers, rate limits and spend caps, and Errors.

Silicon Network›Docs›Guides›Quickstarts by language›curl54 items