OpenAI-Compatible
Drop-in replacement — just change the base URL
Quickstart: OpenAI-Compatible API
Already using the OpenAI SDK? Switch to Archipelag.io by changing two lines — your base URL and API key.
### Set your API key ```bash export ARCHIPELAG_API_KEY="your-api-key-here" ``` ### Use the OpenAI SDK with Archipelag.io {% tabs() %} {% tab(name="Python") %} ```python from openai import OpenAI client = OpenAI( base_url="https://api.archipelag.io/api/v1", api_key="your-api-key-here", # or set ARCHIPELAG_API_KEY ) response = client.chat.completions.create( model="llm-chat", messages=[ {"role": "user", "content": "Say hello in three languages"} ], ) print(response.choices[0].message.content) ```
```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.archipelag.io/api/v1", apiKey: "your-api-key-here", // or set ARCHIPELAG_API_KEY }); const response = await client.chat.completions.create({ model: "llm-chat", messages: [ { role: "user", content: "Say hello in three languages" }, ], }); console.log(response.choices[0].message.content); ```
{% end %}
Run it
python hello.py
# or: node hello.mjs
Hello! (English)
Bonjour! (French)
Hola! (Spanish)
{% end %}
Streaming
Streaming works exactly as you’d expect with the OpenAI SDK:
{% tab(name="Python") %} ```python stream = client.chat.completions.create( model="llm-chat", messages=[ {"role": "user", "content": "Say hello in three languages"} ], stream=True, ) for chunk in stream: content = chunk.choices[0].delta.content if content: print(content, end="", flush=True) ```
```javascript const stream = await client.chat.completions.create({ model: "llm-chat", messages: [ { role: "user", content: "Say hello in three languages" }, ], stream: true, }); for await (const chunk of stream) { const content = chunk.choices[0]?.delta?.content; if (content) process.stdout.write(content); } ```
{% end %}
Model mapping
The API accepts standard OpenAI model names and maps them to Archipelag.io Cargos:
| OpenAI model | Archipelag.io Cargo |
|---|---|
gpt-3.5-turbo | llm-chat |
gpt-4 | llm-chat |
gpt-4o | llm-chat |
llm-chat | llm-chat (direct) |
Note
All model names currently route to the `llm-chat` Cargo (Mistral 7B). As more models become available, each will get its own Cargo slug.Key differences from OpenAI
- Base URL:
https://api.archipelag.io/api/v1(nothttps://api.openai.com/v1) - API key header: Same format —
Authorization: Bearer <key> - Model names: Use
llm-chatdirectly, or standard OpenAI names which are mapped automatically - Rate limits: 100 requests/minute (per API key)
Next steps
- curl quickstart — raw HTTP for debugging
- Python SDK quickstart — native SDK with streaming iterators
- User Guide — models, pricing, error handling
