API Documentation

Integrate top-tier open-weight models into your app in minutes. Our API is structurally identical to the OpenAI standard, allowing drop-in replacements.

Authentication

The Helyx API uses API keys for authentication. You can obtain your free API key from your dashboard. Authentication is performed via the standard HTTP Authorization header.

Authorization: Bearer YOUR_API_KEY

Keep your keys secure. Do not expose your API keys in client-side code (like browser-facing JavaScript). Always route requests through your own backend.

Base URL

All API requests must be routed to our universal v1 endpoint. If you are using an official OpenAI SDK, simply override the base URL.

BASE_URL = "https://helyxai.space/v1"

Chat Completions POST /v1/chat/completions

Used for text-based models like Llama 4, Mistral, Qwen, and DeepSeek. Generates a model response for the given chat conversation.

from openai import OpenAI

client = OpenAI(
    base_url="https://helyxai.space/v1",
    api_key="sk-your-api-key"
)

response = client.chat.completions.create(
    model="gpt-oss-120b", # Swap this string for any text model
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing."}
    ]
)

print(response.choices[0].message.content)

Image Generation POST /v1/images/generations

Creates an image given a prompt. Fully compatible with the standard OpenAI images SDK. Use models like `flux-1`.

from openai import OpenAI

client = OpenAI(
    base_url="https://helyxai.space/v1",
    api_key="sk-your-api-key"
)

response = client.images.generate(
    model="flux-1",
    prompt="A cinematic shot of a futuristic cyberpunk city at night, 4k",
    size="1024x1024",
    n=1
)

print(response.data[0].url)

Video Generation POST /v1/videos/generations

Because the official OpenAI SDK does not yet natively support a `videos` module, you can easily call this endpoint using standard HTTP requests.

import requests

url = "https://helyxai.space/v1/videos/generations"
headers = {
    "Authorization": "Bearer sk-your-api-key",
    "Content-Type": "application/json"
}
data = {
    "model": "kling-video",
    "prompt": "A golden retriever flying on a skateboard through clouds",
    "duration": 5 # seconds
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

print(result['data'][0]['url'])

Streaming Responses (SSE)

For faster perceived response times in UI applications, set `stream=True` in your chat completion requests. Helyx fully supports Server-Sent Events (SSE). When streaming, token usage is automatically appended to the final `[DONE]` chunk to ensure accurate billing and limit tracking.

response = client.chat.completions.create(..., stream=True)

Errors & Rate Limits

The Free plan grants 100,000 tokens daily, resetting every 24 hours. Media generation (Images/Video) is converted into equivalent token costs dynamically based on the model's pricing.

Status Code Error Type Description
401 invalid_api_key API key is missing, inactive, or incorrect.
403 insufficient_quota Your account tier does not have access to this specific model.
429 rate_limit_exceeded You have exhausted your 100k daily free token limit. Resets at midnight.
500 server_error The upstream provider failed to process the request.