curl
Make your first API call from the terminal
Quickstart: curl
Make your first Archipelag.io API call in under 2 minutes using curl.
### Set your API key ```bash export ARCHIPELAG_API_KEY="your-api-key-here" ``` ### Send a chat request ```bash curl -X POST https://api.archipelag.io/api/v1/chat/completions \ -H "Authorization: Bearer $ARCHIPELAG_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "llm-chat", "messages": [ {"role": "user", "content": "Say hello in three languages"} ] }' ``` ### See the response ```json { "id": "chatcmpl-abc123", "object": "chat.completion", "model": "llm-chat", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! (English)\nBonjour! (French)\nHola! (Spanish)" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 18, "total_tokens": 30 } } ```
Streaming
To receive tokens as they’re generated, add "stream": true:
curl -X POST https://api.archipelag.io/api/v1/chat/completions \
-H "Authorization: Bearer $ARCHIPELAG_API_KEY" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "llm-chat",
"messages": [
{"role": "user", "content": "Say hello in three languages"}
],
"stream": true
}'
The response arrives as server-sent events:
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}
data: [DONE]
Next steps
- Python SDK quickstart — richer client with streaming iterators
- OpenAI-compatible quickstart — use your existing OpenAI code
- User Guide — models, pricing, error handling
