Developers

WormGPT API

An OpenAI-compatible HTTP API for chat completions. Point any OpenAI client athttps://worm-gpt.com/v1and swap in your WormGPT key.

Overview

Introduction

The WormGPT API is OpenAI-compatible. Any client that speaks the OpenAI/v1/chat/completionsprotocol works — just change the base URL and API key.

  • Base URL: https://worm-gpt.com/v1
  • Auth: Authorization: Bearer wg_live_…
  • Content-Type: application/json
  • Streaming: Server-Sent Events (SSE) with OpenAI-format chunks and a [DONE] terminator.

Bearer tokens

Authentication

All requests must include your key in the Authorization header:

http
Authorization: Bearer wg_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Create and manage keys on the Developer page. Keys are shown once at creation — WormGPT stores only a hash. Revoke a key anytime; new requests will fail with 401 revoked_api_key.

Verify your key:

curl https://worm-gpt.com/v1/models \
  -H "Authorization: Bearer $WORMGPT_API_KEY"

Keep keys server-side

Never embed wg_live_… in browser code, mobile apps, or public repos. Proxy through your backend.

POST /v1/chat/completions

Chat completions

Generate a model reply from a list of messages. Returns a JSON completion, or an SSE stream when stream: true.

POST/v1/chat/completions

Request body

FieldTypeDescription
modelstringModel ID. Defaults to wormgpt-flash. See /v1/models.
messagesrequiredMessage[]Ordered conversation. Each item is { role: 'system'|'user'|'assistant', content: string }. 1–100 messages.
streambooleanIf true, response is text/event-stream chunks. Defaults to false.
temperaturenumberSampling temperature between 0 and 2.
top_pnumberNucleus sampling probability between 0 and 1.
max_tokensintegerCap on generated tokens. Up to 16,000.

Example request

curl https://worm-gpt.com/v1/chat/completions \
  -H "Authorization: Bearer $WORMGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wormgpt-flash",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain HTTPS in one sentence."}
    ]
  }'

Example response

json
{
  "id": "chatcmpl-d6481db091ba4f5fab9897a0",
  "object": "chat.completion",
  "created": 1783120047,
  "model": "wormgpt-flash",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "HTTPS encrypts data in transit between your browser and a server." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 18, "completion_tokens": 14, "total_tokens": 32 }
}

stream: true

Streaming (SSE)

Set stream: true in the body. The response is text/event-stream: one JSON payload per data: line, terminated by data: [DONE]. The final chunk carries finish_reason and a usage object.

Streaming request

curl -N https://worm-gpt.com/v1/chat/completions \
  -H "Authorization: Bearer $WORMGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wormgpt-flash",
    "stream": true,
    "messages": [{"role": "user", "content": "Write a haiku about firewalls."}]
  }'

Streaming response

event-stream
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1783120061,"model":"wormgpt-flash","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1783120061,"model":"wormgpt-flash","choices":[{"index":0,"delta":{"content":"Firewalls "},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1783120061,"model":"wormgpt-flash","choices":[{"index":0,"delta":{"content":"stand guard..."},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1783120061,"model":"wormgpt-flash","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":9,"completion_tokens":22,"total_tokens":31}}

data: [DONE]

GET /v1/models

Models

List available models.

GET/v1/models

wormgpt-flash

Fast, general-purpose

Low-latency chat, code assistance, and everyday queries. The default model when you omit model.

wormgpt-pro

Deeper reasoning

Longer, more thorough responses for research, analysis, and multi-step reasoning. Higher token cost.

Example response

json
{
  "object": "list",
  "data": [
    { "id": "wormgpt-flash", "object": "model", "created": 1700000000, "owned_by": "wormgpt", "description": "Fast general-purpose model." },
    { "id": "wormgpt-pro",   "object": "model", "created": 1700000000, "owned_by": "wormgpt", "description": "Higher-quality reasoning model." }
  ]
}

Per-key and per-plan

Rate limits

Every response includes standard rate-limit headers so you can back off gracefully. Limits are enforced per API key, and monthly quotas are shared across all keys on your account.

PlanRequests / minuteRequests / month
Free601,000
Pro (active subscription)600100,000

Response headers

FieldTypeDescription
X-PlanstringThe plan applied to this request: free or pro.
X-RateLimit-Limit-RequestsintegerPer-minute request cap for the current plan.
X-RateLimit-Remaining-RequestsintegerRequests remaining in the current minute window.
X-RateLimit-Reset-RequestsintegerSeconds until the minute window resets.
X-RateLimit-Limit-MonthlyintegerMonthly request cap for the current plan.
X-RateLimit-Remaining-MonthlyintegerRequests remaining in the current calendar month (UTC).
Retry-AfterintegerSent on 429 responses. Seconds to wait before retrying.

When you exceed a limit, the API returns 429 rate_limit_error with code: rpm (per-minute) or code: monthly. Use exponential backoff with jitter.

OpenAI-style error bodies

Errors

Errors return JSON in this shape:

json
{
  "error": {
    "message": "Invalid API key.",
    "type": "invalid_request_error",
    "code": "invalid_api_key",
    "param": null
  }
}
StatusCodeMeaning
400invalid_request / invalid_body / model_not_foundThe request body is malformed or references a model that does not exist.
401invalid_api_key / revoked_api_keyMissing, malformed, invalid, or revoked API key.
402upstream_errorUpstream AI credit exhausted. Add credits or upgrade your plan.
429rpm / monthlyRate limit exceeded. Check X-RateLimit-* and Retry-After headers.
500server_misconfiguredThe API backend is missing required configuration.
502upstream_errorUpstream model provider returned an error. Retry after a short backoff.

Handle keys carefully

Security

  • Keys are stored as SHA-256 hashes. Once created, the plaintext is never retrievable — save it immediately.
  • Rotate keys regularly and revoke any key that may have been exposed.
  • All requests must use HTTPS. Plaintext HTTP is rejected.
  • Never call the API directly from a browser or mobile app with a production key. Proxy through your server.
  • Scope keys per environment (e.g. prod-backend, staging) so you can revoke one without disrupting others.

What's new

Changelog

v1.0July 3, 2026

Public API launch

  • New endpoint: POST /v1/chat/completions (OpenAI-compatible).
  • New endpoint: GET /v1/models.
  • Server-Sent Events streaming for chat completions.
  • Per-key rate limits and per-plan monthly quotas with X-RateLimit-* headers.
  • Hashed API-key storage, one-time reveal, and revocation from the Developer page.
  • Per-key daily usage logging (requests, prompt/completion tokens, errors).