API Reference
All endpoints use https://api.codelace.com as the base URL. Authenticated endpoints require a Bearer cl_... token header.
Inference
/v1/chat/completionsOpenAI-compatible chat completion. Streaming supported. Works with any OpenAI SDK.
{
"model": "anthropic/claude-opus-4.6",
"stream": true,
"messages": [
{"role": "user", "content": "Hello"}
]
}/v1/modelsList available models on the network.
{
"data": [
{"id": "anthropic/claude-opus-4.6", "object": "model"},
{"id": "openai/gpt-5.4", "object": "model"}
]
}Authentication
/api/v1/auth/otp/requestRequest a 6-digit email verification code.
{ "email": "you@company.com" }{
"email": "you@company.com",
"expires_in_sec": 600
}/api/v1/auth/otp/verifyVerify the OTP code and receive an API key.
{
"email": "you@company.com",
"code": "123456"
}{
"user_id": "uuid",
"api_key": "cl_...",
"email": "you@company.com",
"credit_balance_usd": 0
}/api/v1/auth/meGet the authenticated user profile.
{
"id": "uuid",
"email": "you@company.com",
"display_name": "Jane"
}/api/v1/auth/keyList all API keys for the authenticated user.
[
{
"id": "uuid",
"key_prefix": "cl_ab12",
"name": "production",
"created_at": "2026-03-01T00:00:00Z"
}
]/api/v1/auth/keyCreate a new API key.
{ "name": "production" }{
"id": "uuid",
"key_prefix": "cl_ab12",
"full_key": "cl_ab12...full_key"
}/api/v1/auth/key/{keyId}Revoke an API key.
Customer
/api/v1/customer/balanceGet the current credit balance.
{
"credit_balance_usd": 30.00
}/api/v1/customer/usageGet consumption stats including recent requests.
{
"request_count": 42,
"total_input_token": 50000,
"total_output_token": 12000,
"total_cost_usd": 15.50
}/api/v1/customer/paymentGet payment history.
[
{
"id": "uuid",
"amount_usd": 25,
"status": "completed",
"created_at": "2026-03-01T00:00:00Z"
}
]Stripe
/api/v1/stripe/setupCreate a Stripe setup session to save a card without charging it. On first successful setup, the account receives $1 in trial credit.
{
"checkout_url": "https://checkout.stripe.com/..."
}/api/v1/stripe/checkoutCreate a Stripe checkout session to purchase credit. Minimum top-up is $10.
{ "amount_usd": 25 }{
"checkout_url": "https://checkout.stripe.com/..."
}Public
/api/v1/public/pricingGet model pricing. No authentication required.
[
{
"model": "anthropic/claude-opus-4.6",
"input_per_1m": 2.50,
"output_per_1m": 12.50
}
]