Liking cljdoc? Tell your friends :D

Provider API

Module: im.ttalk/clj-agent-provider

Source: modules/clj-agent-provider/src

Provider factory

Namespace: im.ttalk.agent.provider.factory.builder

FunctionConfiguration order
create-providerExplicit provider type and opts only
create-provider-with-defaultsBuilt-in defaults, then user opts
create-provider-from-envEnvironment variables
create-provider-autoBuilt-in defaults, environment, then user opts
(require '[im.ttalk.agent.provider.factory.builder :as factory])

(def openai (factory/create-provider-from-env :openai))
(def anthropic (factory/create-provider :anthropic {:api-key "..."}))
(def compatible
  (factory/create-provider :openai-compatible
                           {:base-url "https://internal.example.com/v1"
                            :api-key "..."}))

Factory configuration resolution lives in im.ttalk.agent.provider.factory.config; provider registration is in im.ttalk.agent.provider.factory.registry.

Supported conversation providers

Provider keyNotes
:openaiOpenAI Chat Completions
:openai-responsesOpenAI Responses wire protocol
:anthropicAnthropic Messages
:deepseek, :zhipu, :ollama, :gemini, :mistral, :minimaxFirst-class adapters
:dashscopeAlibaba Cloud DashScope
:xai, :moonshot, :openrouter, :siliconflowOpenAI-compatible ecosystems
:openai-compatGeneric adapter; base URL required
:mockOffline tests and examples

Exact keys are provider-specific. Common keys include :api-key, :base-url, :model, :max-tokens, :temperature, timeout keys, proxy settings, and :thinking controls.

Embeddings

Namespace: im.ttalk.agent.provider.embeddings

Embeddings use the optional IEmbeddingProvider protocol in im.ttalk.agent.model.embedding. The provider module includes OpenAI-compatible and DashScope-native implementations. Conversation provider support does not imply embedding support; probe with embedding-provider? or equivalent checks.

Streaming and transport

Provider stream namespaces convert vendor Server-Sent Events into neutral token and response callbacks. im.ttalk.agent.provider.http.stream-client adds request model validation, cancellation, retry classification, and canonical provider errors. HTTP itself is delegated to im.ttalk/clj-http; do not instantiate vendor HTTP clients in application code.

Wire and schema namespaces under im.ttalk.agent.provider.wire.* and im.ttalk.agent.provider.schema.* are implementation details unless you are adding a new provider dialect.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close