BUILD WITH MEIKAI
A few lines.
A world of possibilities.
One OpenAI-compatible endpoint for the Meikai model catalog. Bring your Meikai token, pick a model, and start building.
01 Get access
Meikai is available by invitation. Ask your Meikai administrator for a personal API token. Tokens start with mk-. The docs and model catalog are public; API requests need an issued token.
Set the token in your environment before running an example:
export MEIKAI_AI_KEY="mk-your-token-here"Use only the personal Meikai token issued to you; do not share it. Ask your administrator to revoke and replace a token if it leaks.
02 Make your first request
These examples send the same request in three languages. No special client library is required. If you already use an OpenAI-compatible SDK, set its base URL and API key to the values above.
curl https://ai.meikai.net/v1/chat/completions \
-H "Authorization: Bearer $MEIKAI_AI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Llama-3.3-70B-Instruct",
"messages": [
{
"role": "user",
"content": "Explain DNS in two sentences."
}
],
"max_tokens": 2048
}'import json, os, urllib.request
# The same request shape works with OpenAI-compatible clients.
payload = json.loads("{\n \"model\": \"meta-llama/Llama-3.3-70B-Instruct\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Explain DNS in two sentences.\"\n }\n ],\n \"max_tokens\": 2048\n}")
request = urllib.request.Request(
"https://ai.meikai.net/v1/chat/completions",
data=json.dumps(payload).encode(),
headers={
"Authorization": "Bearer " + os.environ["MEIKAI_AI_KEY"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(request, timeout=120) as response:
print(json.load(response)["choices"][0]["message"]["content"])const response = await fetch("https://ai.meikai.net/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MEIKAI_AI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "meta-llama/Llama-3.3-70B-Instruct",
"messages": [
{
"role": "user",
"content": "Explain DNS in two sentences."
}
],
"max_tokens": 2048
}),
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
console.log(result.choices[0].message.content);Read the answer from choices[0].message.content. The usage object reports token counts when available.
03 Choose a model
Browse the model catalog and pass an exact model ID in every request. Check which models your token can access through the authenticated models endpoint:
curl https://ai.meikai.net/v1/models -H "Authorization: Bearer $MEIKAI_AI_KEY"The compatibility default for requests that omit model is zai-org/GLM-5.2. Model discovery can omit this default.
The model list can also include black-forest-labs/FLUX.2-klein-4B for image generation. Use a text model for chat completions and the playground.
POST /v1/chat/completions
Chat completions
Send a conversation as a messages array. Include earlier user and assistant messages for a multi-turn conversation. Capabilities and supported parameters vary by model.
| Parameter | Type | Use |
|---|---|---|
model | string | Exact model ID from the Meikai catalog. |
messages | array | Required. Objects with role and content. |
max_tokens | integer | Output budget. Start with 2048; reasoning may use part of it. |
temperature | number | Sampling control, if supported by the model. |
stream | boolean | Set to true for server-sent events. |
{
"choices": [
{
"message": {
"role": "assistant",
"content": "DNS translates domain names into IP addresses."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 12,
"total_tokens": 32
}
}Other /v1/* paths also require authentication. The gateway does not implement every OpenAI endpoint. Use GET /health for an unauthenticated gateway health check; it does not check inference availability.
Stream the answer
Add "stream": true and read the response as server-sent events. Each JSON event can contain choices[0].delta.content; the data: [DONE] event ends the stream. Some events contain only usage, metadata, or reasoning, so do not assume every event has answer text.
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":" there."}}]}
data: [DONE]The playground handles streaming, shows reasoning separately when returned, and lets you stop a request. The playground currently sends text messages; it does not upload images or execute tools.
Errors & troubleshooting
| Status | What to do |
|---|---|
400 | Check that the body is a JSON object and the model supports the parameters. |
401 | Supply an Authorization: Bearer <token> header. |
403 | The token may be invalid or revoked. Ask your administrator. |
404 | Check the route and model ID. The model may no longer be available. |
429 | Wait before retrying; service usage limits may apply. |
502 / 503 | The service may be unavailable. Try again later. |
Reasoning models may spend their output budget before producing visible answer text. If finish_reason is length, increase max_tokens. Reasoning may appear in reasoning_content separately from content.
Gateway errors use {"error":{"message":"…","type":"meikai_gateway"}}. Service errors are presented with Meikai messages; contact your administrator if a problem persists.
Data & privacy
Usage is tagged to your personal token's label. Service logs may retain prompts and responses for operation and troubleshooting.
The playground keeps its token and conversation in the current page's memory, and sends them only when you make API requests. Reloading or leaving the page clears them. “Disconnect” clears the token and chat immediately. Copyable examples use MEIKAI_AI_KEY, never your actual token.
Use the service for approved internal work. Do not send credentials, customer personal data, or confidential material that is not approved for these services.