Quickstart
Syok AI gives you one OpenAI-compatible endpoint in front of every AI provider you've connected. When one runs out of free credits or hits a rate limit, the next one answers automatically. Your code doesn't change.
How Syok AI works
- You bring your own keys. For example Gemini, Groq, Mistral, OpenRouter or Cloudflare Workers AI, which all have free tiers.
- Syok AI puts them in order, either your order or cheapest first.
- It sends each request to the first provider that can take it.
- If a provider fails because of a rate limit, no credit, or being down, it automatically retries on the next one.
You pay each provider directly on your own key. Syok AI only charges for the switching service.
1. Connect providers
- Open the Syok AI app and sign in with Cloudflare. A free Cloudflare account works.
- On Providers, click Connect next to a provider. The guide opens that provider's key page for you.
- Paste the key, click Test, then Save.
- Connect at least 2 or 3 providers so there's always a backup. A good free set is Gemini + Groq + Mistral + Cloudflare Workers AI.
2. Get a developer key
- In the app, open the menu and choose Developer API.
- Switch the Developer API on.
- Click Create key. Copy it straight away: it starts with
syk_and is shown only once. - Copy your Base URL from the same page. It looks like
https://…workers.dev/v1.
In the examples below, replace https://YOUR-SYOK-URL/v1 with your Base URL, and SYOK_API_KEY with your key.
Call the API directly
Send a POST to /chat/completions in the standard OpenAI format. Use the model syok-auto and Syok AI picks the provider.
import os, requests
r = requests.post(
"https://YOUR-SYOK-URL/v1/chat/completions",
headers={"Authorization": f"Bearer {os.environ['SYOK_API_KEY']}"},
json={
"model": "syok-auto",
"messages": [{"role": "user", "content": "What is the meaning of life?"}],
},
)
print(r.json()["choices"][0]["message"]["content"])
print("Answered by:", r.headers.get("X-Syok-Provider"))const res = await fetch("https://YOUR-SYOK-URL/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SYOK_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "syok-auto",
messages: [{ role: "user", content: "What is the meaning of life?" }],
}),
});
const data = await res.json();
console.log(data.choices[0].message.content);
console.log("Answered by:", res.headers.get("X-Syok-Provider"));curl https://YOUR-SYOK-URL/v1/chat/completions \
-H "Authorization: Bearer $SYOK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "syok-auto",
"messages": [{"role": "user", "content": "What is the meaning of life?"}]
}'Supported request fields:
messages, includingsystemmessages;temperature;max_tokensormax_completion_tokens;stream;toolsandtool_choice;- an image in the last user message, using the OpenAI
image_urlformat.
Using the OpenAI SDK
Syok AI speaks the OpenAI API, so the official OpenAI SDKs work as a drop-in replacement. Only the base_url and the key change.
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://YOUR-SYOK-URL/v1", api_key=os.environ["SYOK_API_KEY"])
completion = client.chat.completions.create(
model="syok-auto",
messages=[{"role": "user", "content": "What is the meaning of life?"}],
)
print(completion.choices[0].message.content)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://YOUR-SYOK-URL/v1", apiKey: process.env.SYOK_API_KEY });
const completion = await client.chat.completions.create({
model: "syok-auto",
messages: [{ role: "user", content: "What is the meaning of life?" }],
});
console.log(completion.choices[0].message.content);Streaming
Set "stream": true to get a standard Server-Sent Events stream, for tools that require one. Syok AI waits until one provider has finished the whole answer before it starts sending. That way a provider switch halfway through can never mix two answers together.
stream = client.chat.completions.create(
model="syok-auto",
messages=[{"role": "user", "content": "Write a haiku about the ocean"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")const stream = await client.chat.completions.create({
model: "syok-auto",
messages: [{ role: "user", content: "Write a haiku about the ocean" }],
stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");Tool calling
Tool (function) calling uses the standard OpenAI tools format:
- Your code describes the tools.
- The AI replies with
tool_calls. - Your code runs the tools and sends back the results.
Syok AI skips providers that can't do tool calling and fails over between the ones that can.
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather in a city",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
},
}]
r = client.chat.completions.create(
model="syok-auto",
messages=[{"role": "user", "content": "What's the weather in London?"}],
tools=tools,
)
print(r.choices[0].message.tool_calls)const r = await client.chat.completions.create({
model: "syok-auto",
messages: [{ role: "user", content: "What's the weather in London?" }],
tools: [{
type: "function",
function: {
name: "get_weather",
description: "Get the current weather in a city",
parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
},
}],
});
console.log(r.choices[0].message.tool_calls);Keeping one AI per chat
By default each request goes to the best available provider. To keep the same AI for a whole conversation, so the tone and style stay consistent, send a conversation ID. Syok AI then tries the provider that answered last time first, and only switches if that one fails.
client.chat.completions.create(
model="syok-auto",
messages=history,
extra_headers={"X-Syok-Conversation": "chat-123"},
)curl https://YOUR-SYOK-URL/v1/chat/completions \
-H "Authorization: Bearer $SYOK_API_KEY" \
-H "X-Syok-Conversation: chat-123" \
-H "Content-Type: application/json" \
-d '{"model":"syok-auto","messages":[{"role":"user","content":"Hi again"}]}'You can also pass it as metadata.conversation_id, or use the OpenAI user field. Long conversations are trimmed from the oldest messages so they fit each AI. Your system message and the latest message are always kept.
Response headers
| Header | Meaning |
|---|---|
X-Syok-Provider | Which provider answered, e.g. Groq |
X-Syok-Model | The exact model that answered |
X-Syok-Fallbacks | How many providers were skipped before this one answered (0 = the first one worked) |
X-Syok-Request-Id | A request ID (req_…). Include it when you contact support. |
Models
GET /models lists the models your key can use. Today that's syok-auto, which means "route across my connected providers". Your provider order and the cheapest-first setting in the app decide which provider is tried first.
curl https://YOUR-SYOK-URL/v1/models -H "Authorization: Bearer $SYOK_API_KEY"Frameworks & apps
Anything that lets you set an "OpenAI-compatible" base URL works with Syok AI. Use model syok-auto.
# pip install langchain-openai
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="syok-auto", base_url="https://YOUR-SYOK-URL/v1", api_key=os.environ["SYOK_API_KEY"])
print(llm.invoke("Hello!").content)# pip install litellm
from litellm import completion
r = completion(
model="openai/syok-auto",
api_base="https://YOUR-SYOK-URL/v1",
api_key=os.environ["SYOK_API_KEY"],
messages=[{"role": "user", "content": "Hello!"}],
)// npm install ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const syok = createOpenAICompatible({ name: "syok", baseURL: "https://YOUR-SYOK-URL/v1", apiKey: process.env.SYOK_API_KEY });
const { text } = await generateText({ model: syok("syok-auto"), prompt: "Hello!" });Settings → Models → OpenAI API key:
API key: syk_… (your Syok AI key)
Override base URL: https://YOUR-SYOK-URL/v1
Add model: syok-autoOther frameworks work the same way, including:
- OpenAI Agents SDK
- LlamaIndex
- CrewAI
- Pydantic AI
- LangGraph
Point their OpenAI-compatible client at your Base URL.
Limits & key safety
| Limit | Value |
|---|---|
| Requests per minute, per key | 30 |
| Daily cap, per key | You set it (default 500, up to 10,000). Resets at midnight UTC. |
| Keys per account | Up to 5 |
| Key lifetime | 30, 90 (default) or 365 days |
| Request size | 6 MB |
Built-in protection:
- The full key is shown once. Only a hash is stored.
- Revoke any key instantly, switch the whole Developer API off, or use Panic: revoke all keys.
- A key that hits its daily cap 3 times in 7 days is switched off automatically. That stops a leaked key from being abused for long.
- Developer keys can only chat. They can never read your provider keys, chats or settings.
- Keys only work while your trial or subscription is active.
Errors
Errors use the OpenAI error format: {"error": {"message", "type", "code"}}.
| Status | Code | What to do |
|---|---|---|
| 400 | invalid_request, invalid_json | Fix the request body (check messages) |
| 401 | invalid_api_key, key_revoked, key_expired | Use a valid syk_ key, or create a new one |
| 403 | api_disabled | Switch the Developer API on in the app |
| 413 | request_too_large | Send less than 6 MB |
| 429 | rate_limited, daily_limit_reached | Wait (see Retry-After), or raise your daily cap |
| 502 | upstream_error | Every connected provider failed. Connect more providers or top up one of them. |
Playground: files & skills
In the app's Playground, the 📎 paperclip opens a small menu with two choices.
Attach a file or picture
- Pictures: ask about them, or use them as a reference for image and video.
- Documents: TXT, MD, PDF, Word
.docx, CSV, JSON and more. They're read in your browser and sent as text, so every AI can use them.
Skills & plugins
A skill is a set of standing instructions the AI follows in every Playground chat. To add one:
- Upload one or more
.mdor.txtfiles, such as aSKILL.mdfrom a plugin. Thenameanddescriptionfront matter is read automatically. - Or type a name and the instructions yourself.
Turn each skill on or off with its switch. Skills that are on are sent as a system message, so they work with every provider.
---
name: Spanish customer replies
description: Reply to customers in friendly, simple Spanish
---
Always reply in simple, friendly Spanish.
Keep replies under 120 words and end with a helpful next step.FAQ
Is Syok AI a model provider?
No. Syok AI routes your requests to providers using your own keys, and switches automatically when one runs out.
Does it cost extra per request?
No. There's no per-token markup. You pay the Syok AI subscription (after a 3-day free trial), plus whatever your providers charge on your own keys. Free tiers cost nothing.
Which providers are free?
Google Gemini, Groq, Mistral, OpenRouter's free models and Cloudflare Workers AI all have genuinely free API access, with no card needed. Stack several so you rarely run out.
Where is my data?
Your keys (encrypted) and chats are stored in your personal worker in your own Cloudflare account. See the Privacy Policy.
Need help?
Email support@syok-ai.com, or use the support chat in the app. Include the X-Syok-Request-Id if you have one.