> ## Documentation Index
> Fetch the complete documentation index at: https://docs.radium.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Hello, world!

> A complete, runnable first script with Radium

# Hello, world!

This is a complete, minimal Radium application. Copy it into a file, set your API key, and run it.

## The script

```python hello.py theme={null}
from openai import OpenAI
import os

# 1. Create a client — just change base_url and api_key
client = OpenAI(
    api_key=os.environ["RADIUM_API_KEY"],
    base_url="https://api.radium.cloud/v1",
)

# 2. Send a chat completion request
response = client.chat.completions.create(
    model="clarke-1.0",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is quantum computing in one sentence?"},
    ],
    temperature=0.7,
    max_tokens=256,
)

# 3. Print the response
print(response.choices[0].message.content)

# 4. (Optional) Inspect token usage
print(f"Tokens used: {response.usage.total_tokens}")
```

## Run it

```bash theme={null}
export RADIUM_API_KEY="YOUR_RADIUM_API_KEY"
python hello.py
```

## What it does

1. **Creates an OpenAI-compatible client** pointing at `api.radium.cloud/v1`.
2. **Sends a chat request** to `clarke-1.0` (our Sonnet-class model, ideal for most tasks).
3. **Receives and prints** the model's text response.
4. **Logs usage** so you can see how many tokens were consumed.

## Switch to streaming

Replace the non-streaming call with this to get tokens as they arrive:

```python theme={null}
stream = client.chat.completions.create(
    model="clarke-1.0",
    messages=[{"role": "user", "content": "Count to 10."}],
    stream=True,
)

for chunk in stream:
    delta = chunk.choices[0].delta.content or ""
    print(delta, end="", flush=True)
print()
```

## Switch to Anthropic format

Same logic, different SDK and base URL:

```python hello_anthropic.py theme={null}
from anthropic import Anthropic
import os

client = Anthropic(
    api_key=os.environ["RADIUM_API_KEY"],
    base_url="https://api.radium.cloud",
)

response = client.messages.create(
    model="clarke-1.0",
    max_tokens=256,
    messages=[{"role": "user", "content": "What is quantum computing in one sentence?"}],
)

print(response.content[-1].text)
```

## Next steps

<CardGroup cols={2}>
  <Card title="Streaming response" icon="bolt" href="/examples/streaming-response">Stream tokens in real time</Card>
  <Card title="Tool calling agent" icon="robot" href="/examples/tool-calling-agent">Build an agent that uses tools</Card>
  <Card title="Structured extraction" icon="table" href="/examples/structured-extraction">Extract JSON from text</Card>
  <Card title="Models overview" icon="brain" href="/models/overview">Pick the right model tier</Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.