ChannelDocsOpen workspace ↗

API quickstart

Send a text question through Channel and trace its cost to your client statement. Use the same client key from Rust, Python or C++.

Get a client key

Open your live workspace, select Keys, and create a client. Save the key shown once. Your workspace needs available credit to reserve a request. Card checkout currently awaits merchant activation.

Set CHANNEL_API_KEY in the environment of your server or terminal. Send it as Authorization: Bearer <client key>. Keep it out of browser bundles and source control.

Send your first request

POST https://app.westernrose.uk/v1/chat/completions

Send an optional leading system message followed by up to 31 alternating user and assistant text messages, starting and ending with user, totalling up to 4,096 UTF-8 bytes. The endpoint returns a single JSON response. Each example prints the answer and a JSON receipt with its request ID, GBP debit, provider USD cost and EUR equivalent.

Choose a model

OpenAI · gpt-5.4-mini
Verified through a client key and GBP settlement.
Google · gemini-3.1-flash-lite
Verified through the same endpoint. Change the model string in the example.
Anthropic · claude-haiku-4-5-20251001
Adapter deployed. The last inference test was blocked by the provider account balance.

The model explorer includes catalogue entries beyond the callable routes above. Streaming, tool calls, and multi-message conversations are outside this endpoint’s current contract.

Read the client statement

GET https://app.westernrose.uk/v1/statement with the same bearer key returns the current UTC month for that client. Match channel.request from the chat response to requests[].request. Divide micro_gbp by 1,000,000 for pounds. For example, 68 means £0.000068.

Each settled row records the model, input, cached and output tokens, USD cost in nanodollars, and the GBP exchange rate and date. USD uses billionths of a dollar (usd_nano). EUR uses millionths of a euro (micro_eur), converted at the stored eur_per_usd rate on the FX date. Earlier statements may lack EUR. Only GBP is debited. The workspace platform fee of 4.5% is collected at top-up. A settled request deducts the model cost from available credit.

Handle errors

400 · Invalid request
Check the model ID, message count and UTF-8 length.
401 / 403 · Access
Use an active client key for inference. A workspace session or management key cannot run inference.
402 · Insufficient credit
Check the available balance before sending another request.
502 / 503 · Provider or service unavailable
Keep any returned request ID. Check the statement before retrying an ambiguous failure. A repeat submission is a new billable request.

Building with a coding assistant

Give your assistant the Channel documentation index and ask it to use the connected model list, read the API contract and keep the key in your server environment. Check the request receipt against the client statement after the first call.