AI Skill Hub 推荐使用:可用事为常用的常用器 是一款优质的AI工具。AI 综合评分 7.5 分,在同类工具中表现稳健。如果你正在寻找可靠的AI工具解决方案,这是一个值得深入了解的选择。
可用事为常用的常用器一个学为常用的常用器。常用的常用器一个学为常用的常用器。
可用事为常用的常用器 是一款基于 Elixir 开发的开源工具,专注于 tag1、tag2、tag3 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
可用事为常用的常用器一个学为常用的常用器。常用的常用器一个学为常用的常用器。
可用事为常用的常用器 是一款基于 Elixir 开发的开源工具,专注于 tag1、tag2、tag3 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 克隆仓库 git clone https://github.com/agentjido/req_llm cd req_llm # 查看安装说明 cat README.md # 按 README 完成环境依赖安装后即可使用
# 查看帮助 req_llm --help # 基本运行 req_llm [options] <input> # 详细使用说明请查阅文档 # https://github.com/agentjido/req_llm
# req_llm 配置说明 # 查看配置选项 req_llm --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export REQ_LLM_CONFIG="/path/to/config.yml"
Join the community! Come chat about building AI tools with Elixir and coding Elixir with LLMs in The Swarm: Elixir AI Collective Discord server.
A Req- and Finch-backed package to call LLM APIs that standardizes requests and responses across providers.
llm_db dependencyContext, Message, ContentPart, Tool, StreamChunk, Response, UsageJason.Encoder for simple persistence / inspectiongenerate_text/3, stream_text/3, generate_object/4, bang variants)generate_object/4 renders JSON-compatible Elixir maps validated by a NimbleOptions-compiled schema:auto (default), :json_schema, :tool_strict)provider_options: [web_search: %{max_uses: 5}])Embedding.generate/3 (Not all providers support this)stream_text/3 returns a StreamResponse with both real-time tokens and async metadataprovider_options: [openai_stream_transport: :websocket]ReqLLM.OpenAI.Realtime exposes a low-level WebSocket session API for Realtime modelsstream_text/3response.usage exposes normalized usage and best-effort USD cost from model metadata and provider response dataReqLLM.Error.Invalid.* (Splode)max_tokens -> max_completion_tokens for o1 & o3) to provider-specific names"provider:model", tuples, %LLMDB.Model{} structs, and plain-map model specsReqLLM.model!/1 is the recommended way to validate and normalize full model specsReqLLM.Keys)access_token support for OpenAI and Anthropicopenai-codex credentials from oauth.json / auth.jsonopenai_codex:* targets the ChatGPT Codex backend with OAuth-only auth and automatic account-id extractionLiveFixture) supports cached, live, or provider-filtered runsmix deps.get
The fastest way to get started is with Igniter:
mix igniter.install req_llm
Add req_llm to your list of dependencies in mix.exs:
def deps do
[
{:req_llm, "~> 1.6"}
]
end
Then run:
mix deps.get
```elixir
usage = ReqLLM.StreamResponse.usage(response) ```
Every response includes detailed usage and best-effort cost information calculated from normalized provider usage data plus model pricing metadata:
```elixir {:ok, response} = ReqLLM.generate_text("anthropic:claude-haiku-4-5", "Hello")
response.usage #=> %{
When using web search or generating images, additional usage metadata is available:
```elixir
{:ok, response} = ReqLLM.generate_text(model, prompt, provider_options: [web_search: %{max_uses: 5}])
response.usage.tool_usage #=> %{web_search: %{count: 2, unit: "call"}}
response.usage.cost #=> %{tokens: 0.001, tools: 0.02, images: 0.0, total: 0.021}
{:ok, response} = ReqLLM.generate_image("openai:gpt-image-1.5", prompt)
response.usage.image_usage #=> %{generated: %{count: 1, size_class: "1024x1024"}}
A native ReqLLM telemetry surface is published for every request, including streaming:
- `[:req_llm, :request, :start | :stop | :exception]` for lifecycle timing, summaries, and usage
- `[:req_llm, :reasoning, :start | :update | :stop]` for standardized thinking and reasoning milestones
- `[:req_llm, :token_usage]` for backwards-compatible token and cost measurements
All events share a `request_id` so you can correlate request lifecycle, reasoning lifecycle, and billing data across providers.
For OpenTelemetry, attach `ReqLLM.OpenTelemetry` once to emit GenAI client spans, optional GenAI metrics, cost attributes, and Langfuse-friendly message capture.
elixir ReqLLM.OpenTelemetry.attach("req-llm-otel", content: :attributes, langfuse: true) ```
See examples/scripts/usage_cost_search_image.exs and run it from examples/ with mix run scripts/usage_cost_search_image.exs for a multi-provider smoke test that validates search tool and image generation cost metadata. For comprehensive documentation, see the Telemetry Guide and Usage & Billing Guide.
The new StreamResponse provides flexible access patterns:
```elixir
model = "anthropic:claude-haiku-4-5"
ReqLLM.generate_text!(model, "Hello world") #=> "Hello! How can I assist you today?"
schema = [name: [type: :string, required: true], age: [type: :pos_integer]] person = ReqLLM.generate_object!(model, "Generate a person", schema) #=> %{name: "John Doe", age: 30}
{:ok, image_response} = ReqLLM.generate_image("openai:gpt-image-1.5", "A simple red square") image_bytes = ReqLLM.Response.image_data(image_response) File.write!("red_square.png", image_bytes)
Note: Google image models gemini-2.5-flash-image and gemini-3-pro-image-preview reject :n; specify the image count in the prompt.
elixir {:ok, response} = ReqLLM.generate_text( model, ReqLLM.Context.new([ ReqLLM.Context.system("You are a helpful coding assistant"), ReqLLM.Context.user("Explain recursion in Elixir") ]), temperature: 0.7, max_tokens: 200 )
{:ok, response} = ReqLLM.generate_text( model, "What's the weather in Paris?", tools: [ ReqLLM.tool( name: "get_weather", description: "Get current weather for a location", parameter_schema: [ location: [type: :string, required: true, doc: "City name"] ], callback: {Weather, :fetch_weather, [:extra, :args]} ) ] )
ReqLLM uses Finch for streaming connections with automatic connection pooling. By default, we use HTTP/1-only pools to avoid a known Finch mixed-protocol ALPN bug with large request bodies:
```elixir
config :req_llm, stream_pool_timeout: 120_000, stream_pool_protocols: [:http1], stream_pool_size: 1, stream_pool_count: 8 ```
Important: Due to Finch issue #265, mixed HTTP/1+HTTP/2 ALPN pools may fail when sending request bodies larger than 64KB (large prompts, extensive context windows). This is a bug in Finch's mixed-protocol flow control path, not a limitation of HTTP/2 itself.
If you know all target providers support HTTP/2, you can configure HTTP/2-only pools:
```elixir
config :req_llm, stream_pool_protocols: [:http2], stream_pool_count: 8
**ReqLLM will error with a helpful message if you try to send a large request body with mixed HTTP/1+HTTP/2 pools.** The error will reference this section for configuration guidance.
Streaming responses hold a connection until completion. For high-scale deployments, tune both the Finch pool capacity and the stream checkout timeout:
elixir
round_robin = Finch.Pool.Strategy.RoundRobin.new()
config :req_llm, stream_pool_timeout: 300_000, stream_pool_protocols: [:http1], stream_pool_size: 1, stream_pool_count: 32, stream_pool_strategy: {Finch.Pool.Strategy.RoundRobin, round_robin}
With the default HTTP/1 transport, concurrent streams per origin are roughly `stream_pool_size * stream_pool_count`. Prefer increasing `stream_pool_count` first when a single pool worker is under pressure; increase `stream_pool_size` when each worker should hold more concurrent HTTP/1 connections. For high worker counts, a round-robin `stream_pool_strategy` spreads stream starts more evenly than Finch's default random selection. These settings configure ReqLLM's default Finch pool; an explicit `finch: [pools: ...]` configuration takes precedence.
If you need origin-specific pools, HTTP/2, connection options, or pool metrics, configure Finch directly:
elixir
config :req_llm, finch: [ name: ReqLLM.Finch, pools: %{ :default => [protocols: [:http1], size: 1, count: 32] } ]
Use `pool_timeout: ...` on an individual `stream_text/3` or `stream_object/4` call when one workload needs a longer connection checkout window than the global `stream_pool_timeout` setting.
Advanced users can specify custom Finch instances per request:
elixir {:ok, response} = ReqLLM.stream_text(model, messages, finch_name: MyApp.CustomFinch) ```
ReqLLM makes key management as easy and flexible as possible - this needs to just work.
Please submit a PR if your key management use case is not covered
Keys are pulled from multiple sources with clear precedence: per-request override → in-memory storage → application config → environment variables → .env files.
```elixir
For advanced non-streaming use cases, you can use ReqLLM providers directly as Req plugins. This is the canonical implementation used by ReqLLM.generate_text/3:
```elixir
{:ok, model} = ReqLLM.model("anthropic:claude-haiku-4-5") {:ok, provider_module} = ReqLLM.provider(model.provider) {:ok, request} = provider_module.prepare_request(:chat, model, "Hello!", temperature: 0.7)
ReqLLM 是一个基于 Elixir 的语言模型(LLM)框架,提供了一个统一的接口来访问不同的语言模型提供商。它支持 45 多个提供商和 665 多个模型,包括 Anthropic、Google、Microsoft 等知名提供商。 ReqLLM 还提供了一个可扩展的架构,使得开发者可以轻松地添加新的提供商和模型。
ReqLLM 的主要功能包括:提供商中立的模型注册表,支持 45 多个提供商和 665 多个模型;可扩展的架构,使得开发者可以轻松地添加新的提供商和模型;支持多模态内容部分(文本、图像 URL、工具调用、二进制数据);提供了一个统一的接口来访问不同的语言模型提供商。
ReqLLM 需要 Elixir 1.12 或更高版本,Docker 和 Finch 等依赖包。开发者需要安装这些依赖包才能使用 ReqLLM。
ReqLLM 支持多种安装方式,包括 Igniter、mix deps.get 等。开发者可以选择适合自己的安装方式。
ReqLLM 的使用教程包括了如何访问使用元数据、使用成本跟踪、生成文本、生成图像等功能。开发者可以通过这些教程来快速上手 ReqLLM。
ReqLLM 支持多种配置方式,包括环境变量、.env 文件和应用配置。开发者可以通过这些配置方式来定制 ReqLLM 的行为。
ReqLLM 提供了一个 API 来管理 API 密钥。开发者可以通过这个 API 来轻松地管理 API 密钥。
ReqLLM 支持通过 Finch 来实现流式连接。开发者可以通过 Finch 来实现流式连接,提高 ReqLLM 的性能和可扩展性。
常用的常用器一个学为常用的常用器。常用的常用器。常用的常用器。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
总体来看,可用事为常用的常用器 是一款质量良好的AI工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | req_llm |
| 原始描述 | 开源AI工具:Req plugin to query AI providers。⭐520 · Elixir |
| Topics | tag1tag2tag3 |
| GitHub | https://github.com/agentjido/req_llm |
| License | Apache-2.0 |
| 语言 | Elixir |
收录时间:2026-05-19 · 更新时间:2026-05-30 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。