codeSDK Usage

This page provides concrete examples for using 1minrelay with OpenAI-compatible SDKs and tools such as Python, Node.js, and curl.

All examples follow the same key rules:

  • The Base URL contains your 1minrelay key.

  • The API key used in the code is your 1min.ai key.

  • Request bodies use the standard OpenAI Chat Completions format.


For all examples, it is recommended to store keys in environment variables:

  • ONE_MIN_RELAY_KEY – your 1minrelay key (from email).

  • ONE_MIN_AI_KEY – your 1min.ai API key.

This avoids hardcoding secrets into your source code.


Python (OpenAI SDK)

import os
from openai import OpenAI

ONE_MIN_RELAY_KEY = os.getenv("ONE_MIN_RELAY_KEY")
ONE_MIN_AI_KEY = os.getenv("ONE_MIN_AI_KEY")

client = OpenAI(
    api_key=ONE_MIN_AI_KEY,
    base_url=f"https://1minrelay.kokodev.cc/{ONE_MIN_RELAY_KEY}/v1",
)

response = client.chat.completions.create(
    model="gpt-4o-mini",  # Replace with a 1min.ai-supported model name if needed
    messages=[
        {"role": "user", "content": "Hello from 1minrelay via Python SDK."}
    ],
)

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

Notes:

  • base_url includes the relay key and /v1.

  • api_key is the 1min.ai key.

  • The chat.completions.create call uses the standard OpenAI-style parameters.


Node.js (OpenAI SDK)

Notes:

  • baseURL includes the 1minrelay key.

  • apiKey is the 1min.ai key.

  • The call structure is the same as for OpenAI.


curl

Notes:

  • The URL includes the /v1/chat/completions endpoint explicitly.

  • The Authorization header uses your 1min.ai key.

  • The JSON body is standard OpenAI chat format.


Other OpenAI-Compatible SDKs and Clients

Any SDK or client that supports:

  • Custom Base URL or endpoint, and

  • A configurable API key

can be used with 1minrelay by:

  1. Setting the Base URL to:

    or, if the SDK requires direct endpoint configuration:

  2. Providing your 1min.ai API key in the SDK’s API key or Authorization configuration.

  3. Using the SDK’s standard OpenAI Chat Completions interface.


Quick Reference Table

SDK / Tool
Base URL
API Key
Endpoint Type

Python SDK

https://1minrelay.kokodev.cc/<KEY>/v1

1min.ai API key

Root /v1

Node SDK

https://1minrelay.kokodev.cc/<KEY>/v1

1min.ai API key

Root /v1

curl

https://1minrelay.kokodev.cc/<KEY>/v1/chat/completions

1min.ai API key

Explicit /chat/completions

Last updated