API Documentation

Integrate the high-performance edge AI reseller network into your production stacks.

1. Edge Authentication & Gateway

Native1API operates entirely on V8 edge isolates. Requests must be authenticated using a valid Google Firebase JWT ID Token passed in the Authorization header.

// Headers required on all completions requests

Authorization: Bearer YOUR_FIREBASE_ID_TOKEN

Content-Type: application/json

POST

/v1/chat/completions

Dispatches chat completions payload to Cloudflare Workers serverless GPU catalog or custom provider routing target (if BYOK key is set).

Example Request Body

{
  "model": "@cf/meta/llama-3.2-3b-instruct",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "What is the capital of France?" }
  ],
  "temperature": 0.7,
  "max_tokens": 1024,
  "stream": false
}

Example Response (Standard OpenAI Object)

{
  "id": "chatcmpl-91375c32-b7e6-42d4-a1db-4965efea",
  "object": "chat.completion",
  "created": 1718227653,
  "model": "@cf/meta/llama-3.2-3b-instruct",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": -1,
    "completion_tokens": -1,
    "total_tokens": -1
  }
}

2. Storing Stored Keys (BYOK Flow)

To route requests through external providers (e.g. OpenRouter, Together AI) without exposing raw API keys on the client, save keys to our secure edge PBKDF2/AES-GCM key vault.

POST /v1/vault

Saves or updates a provider credential. Body requires {"apiKey": "YOUR_KEY"}.

GET /v1/vault

Queries whether a credential exists in the vault. Returns {"exists": true/false}.

DELETE /v1/vault

Deletes the stored key from the vault. Gateway falls back to default Workers AI.

3. Local SDK Modules & Integrations

Client SDK wrappers are provided out-of-the-box. Access the source code or copy them into your local workspace directly: