008

Docs

— Build on Arclight in five minutes.

One API for chat, code, vision, embeddings, speech and agents, in the OpenAI format your code already speaks. Install, set a key, call a model.

01

Quickstart

Three steps from nothing to a model’s answer. Pick your language once: every example on the page follows it.

1

Install the client and set your key

Create a key in the console under Settings → API keys. It is shown once, so keep it in your secret store.

terminal
pip install openai arclight
export ARCLIGHT_API_KEY="arc_sk_..."

2

Make your first call

Arclight answers in the OpenAI format, so the official clients work as they are: only the address and the key change.

app.py
from openai import OpenAI

client = OpenAI(
    base_url="https://api.arclight.ai/v1",
    api_key="ARCLIGHT_API_KEY",
)

answer = client.chat.completions.create(
    model="arc-7",
    messages=[{"role": "user", "content": "Summarise this contract"}],
)
print(answer.choices[0].message.content)

3

Read the answer

Every answer carries its usage and a request id. Quote the id when you write to support and we will find the call in seconds.

response.json
{
  "id": "chatcmpl-8f3a2c",
  "model": "arc-7",
  "choices": [{ "message": { "role": "assistant", "content": "The contract renews..." } }],
  "usage": { "prompt_tokens": 1840, "completion_tokens": 212 },
  "arclight": { "region": "eu-west-1", "latency_ms": 184 }
}

02

Authentication

Every request carries a key in the Authorization header. A key belongs to a project, and a project to a region.

header
Authorization: Bearer arc_sk_live_2f9c...

Key

Starts with

Use it for

Secret key

arc_sk_

Every endpoint, for your servers only. Never ship it to a browser or an app.

Restricted key

arc_rk_

Only the endpoints and models you tick, with a spend cap of its own.

Project key

arc_pk_

Scoped to one project, its usage billed and logged apart.

03

Streaming

Set stream to true and the answer arrives as server-sent events, a few tokens at a time. The first token of Arc-7 lands in about 180 ms.

stream.py
stream = client.chat.completions.create(
    model="arc-7",
    messages=[{"role": "user", "content": "Write a haiku about GPUs"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

04

Tools

Describe a function with a JSON schema and the model asks for it when it needs it. You run the function and send the result back; agents do that loop for you.

tools.py
tools = [{
    "type": "function",
    "function": {
        "name": "get_order",
        "description": "Look up an order by its number",
        "parameters": {
            "type": "object",
            "properties": {"number": {"type": "string"}},
            "required": ["number"],
        },
    },
}]

answer = client.chat.completions.create(
    model="arc-7",
    messages=[{"role": "user", "content": "Where is order 4417?"}],
    tools=tools,
)
call = answer.choices[0].message.tool_calls[0]
print(call.function.name, call.function.arguments)

05

API reference

The address is https://api.arclight.ai/v1 in every region; the key decides where the request runs.

Inference

POST

/v1/chat/completions

Chat, reasoning, vision and tool calls, streamed or whole

POST

/v1/embeddings

Vectors for search and retrieval, up to 2,048 inputs a call

POST

/v1/audio/transcriptions

Speech to text with speakers and word timestamps

POST

/v1/batches

A file of requests answered within 24 hours, at half price

Models and training

GET

/v1/models

Every model your key can call, with its price and context

POST

/v1/fine-tunes

Start a fine-tune from a dataset in a bucket or an upload

GET

/v1/fine-tunes/{id}

A run’s progress, its checkpoints and evaluations

DELETE

/v1/models/{id}

Remove a private model and the weights we keep

Agents

POST

/v1/agents

Create an agent: its model, tools, budget and guardrails

POST

/v1/agents/{id}/runs

Run an agent on an input; its steps stream as events

GET

/v1/traces/{id}

A run’s trace: every prompt, call, result and token

06

Errors and limits

Errors come back as JSON with a type, a message and the request’s id. Limits are per project, per minute.

Status

Type

What happened

400

invalid_request

A field is missing or malformed; the message names it

401

invalid_api_key

The key is wrong, revoked or from another region

403

model_not_allowed

A restricted key asked for a model it was not given

404

not_found

The model, agent or trace does not exist for this project

409

conflict

A fine-tune with this name is already running

429

rate_limited

Too many requests or tokens this minute; retry after the header’s seconds

500

server_error

Our fault, logged with the request’s id; safe to retry

503

overloaded

A region is at capacity; the SDKs retry another one

Plan

Requests a minute

Tokens a minute

Agent runs at once

Build

60

200K

5

Scale

3,000

10M

100

Enterprise

Custom

Custom

Custom

SDKs

Python, Node, Go and Rust, typed and retried by default.

Install one

Status

Every region’s latency and uptime, minute by minute.

See what changed

Support

An engineer answers within one business hour on Scale.

Talk to us

Create a free website with Framer, the website builder loved by startups, designers and agencies.