Expand description
Asynchronous client library for OpenAI and OpenRouter endpoints.
Provides strongly typed request and response structures, real-time Server-Sent Events (SSE) stream parsing, tool calling schemas, and provider abstractions.
Re-exports§
pub use client::Client;pub use client::ClientBuilder;pub use error::ApiErrorEnvelope;pub use error::ApiErrorPayload;pub use error::ClientError;pub use provider::OPENAI_API_KEY_ENV;pub use provider::OPENAI_BASE_URL_ENV;pub use provider::OPENAI_DEFAULT_BASE_URL;pub use provider::OPENROUTER_API_KEY_ENV;pub use provider::OPENROUTER_DEFAULT_BASE_URL;pub use provider::Provider;pub use stream::BoxChatCompletionStream;pub use stream::ChatCompletionStream;pub use types::ChatChoice;pub use types::ChatChunkChoice;pub use types::ChatChunkDelta;pub use types::ChatCompletionChunk;pub use types::ChatCompletionRequest;pub use types::ChatCompletionResponse;pub use types::ChatMessage;pub use types::ChunkFunctionCall;pub use types::ChunkToolCall;pub use types::EmbeddingData;pub use types::EmbeddingInput;pub use types::EmbeddingRequest;pub use types::EmbeddingResponse;pub use types::FunctionCall;pub use types::FunctionDefinition;pub use types::ListModelsResponse;pub use types::ModelInfo;pub use types::Role;pub use types::ToolCall;pub use types::ToolDefinition;pub use types::Usage;
Modules§
- client
- Main HTTP client implementation for OpenAI and OpenRouter APIs.
- error
- Error types and API error payload definitions for
cera-client. - provider
- Provider definitions and URL / header resolution for remote endpoints.
- stream
- Server-Sent Events (SSE) stream decoder for chat completion chunks.
- types
- Strongly typed request and response definitions for OpenAI and OpenRouter endpoints.
Structs§
- Status
Code - An HTTP status code (
status-codein RFC 9110 et al.).