Skip to content
KedyDocs

Kedy API · Developer guide

Kedy API Documentation

Start building with NOVAQ. A step-by-step technical guide from preparing your account and sending your first API request to processing responses and resolving errors.

model: novaqREST · JSONcURL / Node.js / Python

01Kedy API overview

The Kedy API lets your application send a text request to NOVAQ. This guide covers creating an account, using your API key, sending your first request, and processing the response on your server. The examples follow the basic request format used in the Çiçekli Teknolig participant guide.

POSThttps://api.kedy.dev/v1/chat/completions
01

Your application

Sends user input to your own backend.

02

Your backend

Reads the key from an environment variable and sends the API request.

03

Kedy API

Returns the model response to your server, which passes the result to your application.

If this is your first request, start with the quickstart. See the API reference for request fields or troubleshooting to investigate a failure.

02Quickstart

  1. Create an account and sign in at chat.kedy.dev.
  2. Create an API key on the same platform.
  3. Replace YOUR_API_KEY in the example below with your key to set it for your terminal session.
  4. Run the request command. A successful request returns a JSON response in your terminal.

macOS / Linux

Bash · KEDY_API_KEY
export KEDY_API_KEY="YOUR_API_KEY"

cURL · POST /v1/chat/completions
curl https://api.kedy.dev/v1/chat/completions \
  -H "Authorization: Bearer $KEDY_API_KEY" \
  -H "Content-Type: application/json" \
  --max-time 30 \
  -d '{"model":"novaq","messages":[{"role":"user","content":"Hello"}]}'

Windows · PowerShell

PowerShell · KEDY_API_KEY
$env:KEDY_API_KEY = "YOUR_API_KEY"

PowerShell · Invoke-RestMethod
$body = @{
  model = "novaq"
  messages = @(@{ role = "user"; content = "Hello" })
} | ConvertTo-Json -Depth 6

Invoke-RestMethod `
  -Uri "https://api.kedy.dev/v1/chat/completions" `
  -Method Post `
  -Headers @{ Authorization = "Bearer $env:KEDY_API_KEY" } `
  -ContentType "application/json" `
  -Body $body `
  -TimeoutSec 30

What do these commands do?

The environment variable applies only to the current terminal session. The request sends “Hello” to the novaq model. The 30-second timeout is a client setting chosen for these examples, not an API service limit.

The macOS / Linux example requires cURL. The Windows example uses PowerShell’s built-in HTTP command. Change content to send your own text.

03API keys and authentication

An API key is the secret your application uses to access the Kedy API. Include it in the Authorization header of every request, preceded by Bearer and a space.

HTTP · Authorization
Authorization: Bearer YOUR_API_KEY

  • Store the key in a server environment variable: KEDY_API_KEY.
  • Keep it out of frontend JavaScript, mobile app bundles, and public repositories.
  • The browser should call your backend, which then calls the Kedy API.
  • Keep the key out of screenshots, logs, and prompts you share with development tools.

Local development files

If you use a .env file, exclude it from version control. Share only a placeholder in .env.example with your team.

.gitignore
.env
.env.*
!.env.example

.env.example
KEDY_API_KEY=YOUR_API_KEY

Actually load the environment variable

Creating a .env file does not automatically load it in every runtime. The examples below read the variable set in your terminal. If you use a framework, follow its server-side environment loading method.

04API reference

The examples on this page send a POST request with a JSON body to the endpoint below. The base URL is https://api.kedy.dev, the endpoint path is /v1/chat/completions, and the model ID is novaq.

POST/v1/chat/completions
Request headers
HeaderValueDescription
AuthorizationBearer YOUR_API_KEYAuthenticates the request using your API key.
Content-Typeapplication/jsonIndicates that the request body is JSON.
Basic request body
FieldTypeUsage
modelstring"novaq" in these examples.
messagesarrayAn array containing the messages sent to the model.
messages[].rolestring"user" in this basic request.
messages[].contentstringThe text you want to send to the model.
JSON · Request body
{
  "model": "novaq",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}

Scope of the examples

This guide covers a basic text request. It does not assume support for additional parameters, streaming, tool calls, model limits, or particular pricing. Check the platform for access and usage information for your account.

05Send a request with Node.js

This example uses built-in fetch in Node.js 22 or later and requires no package installation. Save it as request.mjs. Set your key in the same terminal session using the quickstart command, then run the file.

request.mjs · Node.js
const apiKey = process.env.KEDY_API_KEY;
if (!apiKey) throw new Error('Set KEDY_API_KEY first.');

const response = await fetch('https://api.kedy.dev/v1/chat/completions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'novaq',
    messages: [{ role: 'user', content: 'Hello' }]
  }),
  signal: AbortSignal.timeout(30_000)
});

if (!response.ok) {
  throw new Error(`Kedy API returned HTTP ${response.status}.`);
}
const data = await response.json();
const reply = data.choices?.[0]?.message?.content;
if (typeof reply !== 'string' || !reply.trim()) {
  throw new Error('The response did not contain a text message.');
}
console.log(reply);

Terminal · Run
node request.mjs

The code checks that the key is present, sends the JSON request, treats unsuccessful HTTP statuses as errors, and validates that the response contains text. Connection failures or timeouts cause fetch to throw. Wrap the operation in your application’s error handling when integrating it.

06Send a request with Python

This example uses the Python 3 standard library and needs no additional packages. Save it as request.py and run it after setting your API key in the same terminal session.

request.py · Python 3
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("KEDY_API_KEY")
if not api_key:
    raise SystemExit("Set KEDY_API_KEY first.")

payload = {
    "model": "novaq",
    "messages": [{"role": "user", "content": "Hello"}],
}
request = urllib.request.Request(
    "https://api.kedy.dev/v1/chat/completions",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)

try:
    with urllib.request.urlopen(request, timeout=30) as response:
        data = json.load(response)
except urllib.error.HTTPError as error:
    raise SystemExit(f"Kedy API returned HTTP {error.code}.") from None
except (urllib.error.URLError, TimeoutError):
    raise SystemExit("Connection failed or timed out.") from None
except json.JSONDecodeError:
    raise SystemExit("The response was not valid JSON.") from None

try:
    reply = data["choices"][0]["message"]["content"]
except (KeyError, IndexError, TypeError):
    raise SystemExit("The response did not contain a text message.") from None
if not isinstance(reply, str) or not reply.strip():
    raise SystemExit("The response did not contain a text message.")
print(reply)

macOS / Linux · Python
python3 request.py

Windows · Python
py request.py

The request body is encoded as UTF-8. The example checks HTTP errors, connection failures, timeouts, invalid JSON, and responses without a text message.

07Read the response

Check the HTTP status before reading the JSON body. The simplified example below shows the choices[0].message.content path used by the code examples to read text. Additional fields and content in the actual response may vary.

JSON · Simplified example response
{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you?"
      }
    }
  ]
}

  • Check that the choices array is not empty.
  • Validate that message.content is a string.
  • Show a clear error for empty or unexpected responses.
  • Render model output as plain text. Sanitize it if you need to render HTML.
  • Validate the expected format before using model output in an automated action.

08Troubleshooting

If a request fails, inspect its HTTP status and error message. The table below gives investigation steps for common HTTP statuses; the actual API error body may provide more detail.

Checks by HTTP status
StatusFirst check
400Is the JSON valid? Are model and messages correct? Is the message content a string?
401Is the environment variable loaded? Is there a space between Bearer and the key? Is the key valid?
403Check whether your account and key have access to the requested resource on the platform.
404Verify that the URL is https://api.kedy.dev/v1/chat/completions.
429Reduce request frequency. Honor Retry-After if provided; otherwise use increasing delays between retries.
5xxThere may be a temporary server issue. Retry a limited number of times with delays; seek support if it persists.
Timeout / network errorCheck connectivity, DNS, and your client timeout setting.
Avoid uncontrolled retries

Repeatedly sending the same invalid request does not fix it. Correct the request first and limit retries for temporary failures. A server may still have processed a request that timed out.

Works in the terminal, fails in the application

Check that your server can read the environment variable and that the request body uses the same fields as the cURL example. If the browser calls the Kedy API directly, move that request to your backend. Log the status code while keeping the API key and personal messages out of logs.

09Integrate into your project

Once the example request works, move the same operation into a backend endpoint or server function. Your interface should call only your own server; keep the Kedy API key on the server.

  1. Validate input. Reject empty input and choose an appropriate length limit for your application.
  2. Read the key on the server. Return a clear configuration error if KEDY_API_KEY is missing.
  3. Send the API request. Use a JSON serializer such as JSON.stringify or json.dumps to build the body.
  4. Validate the response. Check the HTTP status, JSON format, and text field.
  5. Display the result. Handle loading, success, and errors separately. Prevent duplicate submission while a request is in progress.
  6. Control usage. Add your own authentication and request limits to a public backend.

Before deployment

  • Set the API key in your hosting provider’s server environment variables.
  • Do not assume your local .env file is automatically deployed.
  • Avoid names or configurations that expose secret environment variables to the frontend.
  • Check empty input, missing keys, HTTP errors, and timeouts.
  • Verify that production logs do not expose the key.

10FAQ and support

Where do I get an API key?

Sign in to your account at chat.kedy.dev and create an API key.

Which model do the examples use?

The model ID is novaq. Use this value for the model field in the request body.

Do I need an SDK or an extra package?

No. The Node.js and Python examples on this page use their runtimes’ built-in HTTP tools.

Can I use these examples in the frontend?

Run the part that uses the API key on the server. The frontend should call only your own backend.

What should I share when requesting help?

Share the HTTP status, endpoint, runtime, and an example request with the key removed. Keep your real API key private.

For more help, visit the Kedy contact page. Return to the Çiçekli Teknolig guide for competition videos and participant information.