Your first API request.
Bring your OpenAI or Anthropic client. Create a key, choose an active model, and send your first request.
Browse the current model catalog and rates for model IDs, modalities and published rates. Model availability and supported options can change.
1. Get set up
- Create an account.
- Verify your email. This adds $5 of free credit to your account.
- Create an API key in the console. Keys are shown once; store yours securely.
- Point your OpenAI client at the Actaserve base URL:
| Base URL | Use |
|---|---|
| https://actaserve.com/v1 | Production API |
2. Make your first request
Save your key as the ACTASERVE_API_KEY environment variable. Keep it private and out of source control. These examples use aion-labs/aion-2.0 from the active public catalog; check its current rates before sending a request.
cURL
curl https://actaserve.com/v1/chat/completions \
-H "Authorization: Bearer $ACTASERVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "aion-labs/aion-2.0",
"messages": [{"role": "user", "content": "Say hello in five words"}]
}'
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://actaserve.com/v1",
api_key=os.environ["ACTASERVE_API_KEY"],
)
completion = client.chat.completions.create(
model="aion-labs/aion-2.0",
messages=[{"role": "user", "content": "Say hello in five words"}],
)
print(completion.choices[0].message.content)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://actaserve.com/v1",
apiKey: process.env.ACTASERVE_API_KEY,
});
const completion = await client.chat.completions.create({
model: "aion-labs/aion-2.0",
messages: [{ role: "user", content: "Say hello in five words" }],
});
console.log(completion.choices[0].message.content);
Image generation
Choose an image model from the catalog. Supported sizes depend on the model.
curl https://actaserve.com/v1/images/generations \
-H "Authorization: Bearer $ACTASERVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "black-forest-labs/flux.1-dev",
"prompt": "a lighthouse at dawn, aerial view",
"size": "1024x1024"
}'
Anthropic Messages (cURL)
Use the Messages interface with the same active language model. The API accepts x-api-key as well as Bearer authentication.
curl https://actaserve.com/v1/messages \
-H "x-api-key: $ACTASERVE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "aion-labs/aion-2.0",
"max_tokens": 64,
"messages": [{"role": "user", "content": "Say hello in five words"}]
}'
Endpoints
See supported interfaces and model-dependent limits for details.
| Endpoint | Notes |
|---|---|
| GET /v1/models | Lists every active model with its slug, modality and live per-unit pricing. No request body. |
| POST /v1/chat/completions | OpenAI-compatible chat. Send model and messages; the endpoint returns a completion object. To stream server-sent events, pass "stream": true. |
| POST /v1/images/generations | Send model, prompt and optional size; returns generated image data in the OpenAI images format. |
| POST /v1/videos/generations | Returns a job id immediately. Poll GET /v1/videos/generations/:id until status is completed. Priced per second of output. |
| POST /v1/messages | Anthropic-compatible, including tools and streaming. Auth via x-api-key works too. POST /v1/messages/count_tokens returns an input-token estimate. |
For the selected model, Actaserve orders eligible suppliers by recent failures, session continuity, routing economics, and configured priority. After a qualifying failure, Actaserve can try another eligible supplier.
Agent harnesses
Tools that support the Anthropic Messages API and honor ANTHROPIC_BASE_URL can send requests through Actaserve. Use an active model slug from GET /v1/models:
# Use an active model with a compatible harness
ANTHROPIC_BASE_URL=https://actaserve.com \
ANTHROPIC_API_KEY="$ACTASERVE_API_KEY" \
claude --model "aion-labs/aion-2.0"
Request headers
| Header | Effect |
|---|---|
| X-Acta-Session | Use one id per conversation or agent session. Actaserve keeps requests on the same healthy supplier when possible, which can preserve provider-side cache eligibility without guaranteeing a cache hit. |
| X-Acta-Workload | Attribution: tags spend with a project, team, or agent name, e.g. support-bot, ci-agent. Each tagged job gets its own row on the console's Workloads page with request, spend, and operational evidence. Legacy labels remain analytics-only and are not backfilled into durable Runs. |
Spending limits & policy
Each key can carry a monthly spending limit, a calendar-month hard cap that returns 402 insufficient_quota after the limit, and an access policy. Allowed-model violations return 403 permission_error; blocked providers are removed from routing. Set both when creating a key in the console.
Cached-token pricing
When an upstream reports cached input tokens, Actaserve bills those tokens at 10% of the model's published input rate. Recorded cache usage appears in console usage views.
Errors
| Status | Meaning |
|---|---|
| 401 authentication_error | Missing or invalid API key. Check the Authorization: Bearer header. |
| 402 insufficient_quota | Out of credits. Verify your email for the $5 credit or add credits in the console. |
| 403 permission_error | The key's policy does not allow this model. Adjust the key policy in the console. |
| 404 not_found | Unknown model. List valid slugs with GET /v1/models. |
| 429 rate_limit_exceeded | The key reached its request limit. Wait and retry with exponential backoff. |
| 502 upstream_error | The upstream supplier failed. Check whether the operation completed before retrying. A new request can incur another charge; automatic failover only applies to eligible failures. |
Credits
You get $5 of free credit after verifying your email. Language models are priced per token and image models per image. Live prices appear in the public model catalog. For programmatic access, use the catalog API (JSON).
Still stuck? Email us with the endpoint, model and error message. Keep API keys, prompts and customer data out of your email.