OA
OneAI API
Docs
Free task testPOST /v1/generateUsage + cost controls

Quickstart

Create a key, run a free Task Intelligence request, check usage, then upgrade when production traffic needs paid workflows.

1. Create a server-side API key

Create a key in Console. Keep it on your server and pass it via x-api-key.

curl -X POST https://oneai-saas-api-production.up.railway.app/v1/generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -H "Idempotency-Key: first-free-test-001" \
  -d '{
    "type": "business_strategy",
    "input": {
      "goal": "Validate OneAI API for my product",
      "audience": "SaaS builders",
      "constraints": ["Keep it practical", "Keep it short"]
    },
    "options": { "llm": { "mode": "cheap", "maxCostUsd": 0.03 } }
  }'

2. Read the response

The API returns structured data plus requestId, usage, cost, and trace metadata when debug is enabled.

Success
{
  "success": true,
  "requestId": "req_...",
  "data": { ...schema-valid output... },
  "usage": { "provider": "openai", "model": "gpt-4o-mini" },
  "attempts": 1
}
Failure
{
  "success": false,
  "error": "Failed to produce valid structured output",
  "details": { "code":"VALIDATION_FAILED", "issues":[...] }
}

3. Check usage before scaling

After the first request, confirm requests, tokens, model cost, latency, and failures in Usage.

4. Use the model gateway

For OpenAI-compatible integrations, call /v1/chat/completions with Authorization: Bearer.

curl -s https://oneai-saas-api-production.up.railway.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_KEY" \
  -d '{
    "model": "openai:gpt-5.2",
    "messages": [
      { "role": "user", "content": "Explain OneAI SaaS in one sentence." }
    ],
    "max_completion_tokens": 300
  }'
Upgrade when the use case is real

Free is for validation. Pro unlocks customer-facing support, market, decision, and campaign intelligence. Team unlocks custom task contracts, debug traces, model controls, and higher operating limits.