Skip to content

Use the API

Make an API key and call the cluster's models at api.c4e.ai with the OpenAI SDK.

The models API speaks the OpenAI chat completions format, so the official OpenAI SDKs and most tools that support a custom base URL work with it.

Setting Value
Base URL https://api.c4e.ai/v1
Model DeepSeek-V4.1-Flash-1017 (shown as DeepSeek V4.1 Flash in chat)
Endpoints GET /v1/models, POST /v1/chat/completions (streaming supported)

Make an API key

  1. Sign in to chat

  2. Open your account settings

    Click your name, then Settings, then Account.

  3. Show your keys

    Next to API keys, click Show.

  4. Create the key

    Click Create new secret key and copy it. Treat it like a password: anyone with it can use the models as you.

Keep the key out of code you share. Put it in an environment variable instead:

export C4E_API_KEY="paste-your-key-here"

Python

Install the official SDK with pip install openai, then:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.c4e.ai/v1",
    api_key=os.environ["C4E_API_KEY"],
)

response = client.chat.completions.create(
    model="DeepSeek-V4.1-Flash-1017",
    messages=[{"role": "user", "content": "Explain unified memory in two sentences."}],
)
print(response.choices[0].message.content)

To stream the answer as it’s written, pass stream=True and print each chunk’s choices[0].delta.content.

curl

curl https://api.c4e.ai/v1/chat/completions \
  -H "Authorization: Bearer $C4E_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "DeepSeek-V4.1-Flash-1017", "messages": [{"role": "user", "content": "Hello"}]}'

List the models your key can use with curl https://api.c4e.ai/v1/models -H "Authorization: Bearer $C4E_API_KEY".

Good to know

  • Only the two endpoints above are open. Embeddings, images and other OpenAI endpoints aren’t available.
  • Busy moments queue rather than fail, so a request may take longer when many people are using the models.
  • While a research job has the models paused, the API answers 503 with Retry-After: 60 and a message saying they’re paused. The OpenAI SDKs retry that by themselves (twice by default). A pause can last a few minutes, so for scripts that must finish, raise the retries, for example OpenAI(..., max_retries=6). See Slurm jobs.
  • If you lose a key or think someone else has it, delete it in the same settings page and make a new one.

Type to search…

↑↓ navigate↵ selectEsc close