Aleph Alpha

Aleph Alpha is a European AI company offering the Luminous family of large language models. Their API provides text generation, semantic embeddings, and multimodal capabilities with a focus on enterprise use cases and data sovereignty. Respan gives you full observability over every Luminous call, prompt, and completion — and gateway routing through the OpenAI-compatible Respan endpoint.

Create an account at platform.respan.ai and grab an API key. For gateway, also add credits or a provider key.

Run npx @respan/cli setup to set up with your coding agent.

Setup

1

Install packages

$pip install respan-ai opentelemetry-instrumentation-alephalpha aleph-alpha-client
2

Set environment variables

$export ALEPH_ALPHA_API_KEY="YOUR_ALEPH_ALPHA_API_KEY"
$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

ALEPH_ALPHA_API_KEY is used for Luminous requests. RESPAN_API_KEY is used to export traces to Respan.

3

Initialize and run

1import os
2from aleph_alpha_client import Client, CompletionRequest, Prompt
3from respan import Respan
4from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor
5
6respan = Respan(instrumentations=[AlephAlphaInstrumentor()])
7
8client = Client(token=os.environ["ALEPH_ALPHA_API_KEY"])
9
10request = CompletionRequest(
11 prompt=Prompt.from_text("Say hello in three languages:"),
12 maximum_tokens=100,
13)
14response = client.complete(request, model="luminous-base")
15print(response.completions[0].completion)
16respan.flush()
4

View your trace

Open the Traces page to see your auto-instrumented Luminous spans with prompts, tokens, and latency.

Configuration

ParameterTypeDefaultDescription
api_keystr | NoneNoneFalls back to RESPAN_API_KEY env var.
base_urlstr | NoneNoneFalls back to RESPAN_BASE_URL env var.
instrumentationslist[]Plugin instrumentations to activate (e.g. AlephAlphaInstrumentor()).
customer_identifierstr | NoneNoneDefault customer identifier for all spans.
metadatadict | NoneNoneDefault metadata attached to all spans.
environmentstr | NoneNoneEnvironment tag (e.g. "production").

Attributes

In Respan()

1from respan import Respan
2from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor
3
4respan = Respan(
5 instrumentations=[AlephAlphaInstrumentor()],
6 customer_identifier="user_123",
7 metadata={"service": "luminous-api", "version": "1.0.0"},
8)

With propagate_attributes

1from respan import Respan, propagate_attributes
2from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor
3
4respan = Respan(instrumentations=[AlephAlphaInstrumentor()])
5
6def handle_request(user_id: str, prompt: str):
7 with propagate_attributes(
8 customer_identifier=user_id,
9 thread_identifier="conv_abc_123",
10 metadata={"plan": "pro"},
11 ):
12 response = client.complete(
13 CompletionRequest(prompt=Prompt.from_text(prompt), maximum_tokens=100),
14 model="luminous-base",
15 )
16 print(response.completions[0].completion)
AttributeTypeDescription
customer_identifierstrIdentifies the end user in Respan analytics.
thread_identifierstrGroups related messages into a conversation.
metadatadictCustom key-value pairs. Merged with default metadata.