API Documentation

Integrate our powerful API into your applications with this Python code example.

Getting Started

Begin by installing the OpenAI Python library: pip install openai Then configure your API key as an environment variable for enhanced security.

Authentication

Use your_api_key_here as a placeholder and replace it with your actual API key from your dashboard. Generate a new API key if you don't have one yet.

Model Selection

Access our diverse range of models including Claude 3.7 Sonnet, Deepseek R1, and OpenAI o3-Mini. Each model provides different capabilities and performance characteristics for your specific use case.

Python Code Example

python_example.py

import openai
import os

base_url = "https://api.qlinxx.com/v1" # Set API base URL
api_key = os.getenv("QLINXX_API_KEY", "your_api_key_here") # Set your API key
model = "openai/chatgpt-4o-latest" # Set model here

client = openai.OpenAI(
  api_key=api_key,
  base_url=base_url,
)

# List models

print("Models list:")
models = client.models.list()
for entry in models.data:
  print("-", entry.id)

# Non-streaming chat completion

print("\nChat completion:")
response = client.chat.completions.create(
  model=model,
  messages=[{"role": "user", "content": "Hello, how are you?"}],
  temperature=0.7,
)
print(response.choices[0].message.content)

# Streaming chat completion

print("\nStreaming chat completion:")
stream_response = client.chat.completions.create(
  model=model,
  messages=[{"role": "user", "content": "Explain Python to a beginner."}],
  temperature=0.7,
  stream=True,
  max_tokens=250
)
full_response = ""
for chunk in stream_response:
  delta = chunk.choices[0].delta
  if delta.content:
    full_response += delta.content
    print(delta.content, end='', flush=True)
        

For advanced usage including streaming responses, function calling, and more, please refer to our complete API reference.