ReqLLM. Providers. NearAI
(ReqLLM v1.13.0)
View Source
NEAR AI Cloud provider using the OpenAI-compatible Chat Completions API.
NEAR AI Cloud exposes TEE-backed inference through an OpenAI-compatible
endpoint at https://cloud-api.near.ai/v1. ReqLLM reuses the shared OpenAI
wire-format implementation and adds NEAR-specific compatibility handling:
max_completion_tokensis translated tomax_tokens- unsupported reasoning options are removed before the request is sent
- strict tool schemas are sent without OpenAI's
strictmarker
Configuration
NEARAI_API_KEY=your-api-keyExamples
ReqLLM.generate_text("nearai:anthropic/claude-haiku-4-5", "Hello!")
ReqLLM.stream_text("nearai:openai/gpt-5.4-mini", "Tell me a story",
max_tokens: 512
)
Summary
Functions
Default implementation of attach/3.
Default implementation of attach_stream/4.
Default implementation of build_body/1.
Default implementation of decode_response/1.
Default implementation of decode_stream_event/2.
Callback implementation for ReqLLM.Provider.default_env_key/0.
Default implementation of encode_body/1.
Default implementation of extract_usage/2.
Default implementation of prepare_request/4.
Default implementation of translate_options/3.
Functions
Default implementation of attach/3.
Sets up Bearer token authentication and standard pipeline steps.
Default implementation of attach_stream/4.
Builds complete streaming requests using OpenAI-compatible format.
Default implementation of build_body/1.
Builds request body using OpenAI-compatible format for chat and embedding operations.
Default implementation of decode_response/1.
Handles success/error responses with standard ReqLLM.Response creation.
Default implementation of decode_stream_event/2.
Decodes SSE events using OpenAI-compatible format.
Callback implementation for ReqLLM.Provider.default_env_key/0.
Default implementation of encode_body/1.
Encodes request body using OpenAI-compatible format for chat and embedding operations.
Default implementation of extract_usage/2.
Extracts usage data from standard usage field in response body.
Default implementation of prepare_request/4.
Handles :chat, :object, and :embedding operations using OpenAI-compatible patterns.
Default implementation of translate_options/3.
Pass-through implementation that returns options unchanged.