Appearance
Your first request
Three steps: an account, a key, a request.
1. Sign up
Create an account at app.matterwave.ai. One email address is one account in one organisation; you can rename the organisation and invite members later. The Free plan needs no card and includes 1,000,000 weighted tokens a month on the house model (pricing).
2. Create a key
In the app, open Settings → API keys and create a key. It is shown once. A key needs the chat:write scope to complete and chat:read to list models; the default key has both.
bash
export MATTERWAVE_API_KEY=mw_...
export MATTERWAVE_BASE_URL=https://app.matterwave.ai3. Send a request
With curl:
bash
curl "$MATTERWAVE_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $MATTERWAVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "grt-nano", "messages": [{"role": "user", "content": "Say hello in five words."}]}'With the Python SDK (pip install matterwave-sdk):
python
from matterwave_sdk import MatterWave
client = MatterWave() # reads MATTERWAVE_API_KEY and MATTERWAVE_BASE_URL
completion = client.chat.completions.create(
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(completion.content)With the TypeScript SDK (npm install @matterwave/sdk):
ts
import { MatterWave } from "@matterwave/sdk";
const client = new MatterWave();
const completion = await client.chat.completions.create({
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(completion.choices[0].message.content);Or with the openai package you already use: set base_url to https://app.matterwave.ai/v1 and api_key to your key. The wire format is the same.
Where next
- The /v1 API: streaming, embeddings, errors, request ids.
- Python SDK and TypeScript SDK.
- Clients: web, terminal, VS Code, desktop, Raspberry Pi.
- Signing in a device by code, for the terminal and editor clients.
- Long conversations and compaction.