Can I use Leiolai with the Anthropic Messages API?
Yes. Leiolai 1 accepts Anthropic Messages requests at /v1/messages. Use a Leiolai API key, send a messages array with max_tokens, and read the answer from the returned content blocks. The interface supports text, base64 images, client-defined tools, and streaming.
Read the Leiolai API reference
How do I authenticate a Messages request?
Send your Leiolai sb_ key in the x-api-key header and anthropic-version: 2023-06-01. For an Anthropic SDK, use https://api.leiolai.com as the base URL. The request goes to /v1/messages; the model ID is leiolai-1.
Create and protect an API keyWhat fields does the first request need?
A Leiolai Messages request needs model: leiolai-1, a positive max_tokens cap, and a nonempty messages array. Use user and assistant roles for conversation turns. An Unrestricted key also requires mode; a restricted key can omit mode.
Where do system instructions go?
Put system instructions in the top-level system field of your Leiolai Messages request. Put the user’s question in messages. For example, system can request concise technical explanations while the user message supplies the code question.
How do I continue a conversation?
Resend the relevant earlier messages with the new user turn in your Leiolai request. Include assistant responses and tool results needed for the next answer. Messages is stateless, so the history you send supplies the context.
Understand conversation contextCan I send images through Messages?
Yes. Use a base64 image content block alongside the text question. Describe the task in text, such as reading a chart’s labels or explaining a diagram, so Leiolai has a clear question to answer about the supplied image.
Image formats and input examplesCan Leiolai request a function through Messages?
Yes. Leiolai accepts client-defined functions in the Anthropic Messages format using input_schema. A requested action returns a tool_use content block. Your application runs the function and sends a matching tool_result in the next user message. Keep the tool_use ID with its result so the conversation identifies the completed action.
Handle function calls and resultsHow do I read a Messages stream?
Set stream: true in your Leiolai Messages request. Append delta.text from content_block_delta events when the delta type is text_delta. Function arguments use input_json_delta. message_delta carries the stop reason and output usage; message_stop ends the stream.
Streaming across the supported formatsHow do I choose thinking effort and conversation mode?
Use output_config.effort with low, medium, high, or xhigh. An unrestricted API key also needs mode set to private or non-private. A Private-only or Leiolai Research-only key can omit mode.
Choose Private or Research for API workWhich features should I use another endpoint for?
Use Leiolai Chat Completions or Responses when you need a structured JSON output field. Messages supports the fields listed in the Leiolai API reference; prompt caching, extended thinking blocks, hosted tools, and custom stop sequences are outside that interface. Check those fields when adapting an existing SDK request.
Request schema-valid JSON