pub struct OpenCodeConfig { /* private fields */ }Expand description
Configuration for one OpenCode model and conversation.
Set the application’s own user agent and reuse the session ID for all main and auxiliary requests in the same conversation. Credentials are omitted from the debug representation.
§Example
use adk_model::opencode::{OpenCodeConfig, OpenCodeService};
let config = OpenCodeConfig::new(OpenCodeService::Go, "api-key", "deepseek-v4.1-flash")
.with_user_agent("example-coding-agent/1.0")
.with_session_id("conversation-42");Implementations§
Source§impl OpenCodeConfig
impl OpenCodeConfig
Sourcepub fn new(
service: OpenCodeService,
api_key: impl Into<String>,
model: impl Into<String>,
) -> Self
pub fn new( service: OpenCodeService, api_key: impl Into<String>, model: impl Into<String>, ) -> Self
Creates a config with the selected service’s official URL and model routing.
Sourcepub fn with_api(self, api: OpenCodeApi) -> Self
pub fn with_api(self, api: OpenCodeApi) -> Self
Sets the API explicitly, including for models added after this library release.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Sets a proxy or test endpoint including its /v1 suffix.
Sourcepub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
pub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
Identifies the calling coding application, such as my-coding-agent/1.0.
Sourcepub fn with_session_id(self, session_id: impl Into<String>) -> Self
pub fn with_session_id(self, session_id: impl Into<String>) -> Self
Sets the stable conversation ID sent as x-opencode-session.
Sourcepub fn with_reasoning_effort(self, effort: OpenAIReasoningEffort) -> Self
pub fn with_reasoning_effort(self, effort: OpenAIReasoningEffort) -> Self
Sets reasoning effort for Chat Completions or Responses models.
Messages models use Self::with_anthropic_effort instead.
Sourcepub fn with_anthropic_thinking(self, thinking: ThinkingMode) -> Self
pub fn with_anthropic_thinking(self, thinking: ThinkingMode) -> Self
Sets thinking for models using Anthropic Messages.
Sourcepub fn with_anthropic_effort(self, effort: Effort) -> Self
pub fn with_anthropic_effort(self, effort: Effort) -> Self
Sets output effort for models using Anthropic Messages.
Sourcepub fn with_gemini_thinking(self, thinking: ThinkingConfig) -> Self
pub fn with_gemini_thinking(self, thinking: ThinkingConfig) -> Self
Sets thinking for Gemini GenerateContent models.
Sourcepub fn with_timeouts(self, timeouts: HttpTimeouts) -> Self
pub fn with_timeouts(self, timeouts: HttpTimeouts) -> Self
Sets connect and byte-idle timeouts on the selected protocol client. Existing SDK defaults remain unchanged when this option is unset.
§Example
use adk_model::{HttpTimeouts, OpenCodeConfig, OpenCodeService};
use std::time::Duration;
let config = OpenCodeConfig::new(OpenCodeService::Go, "key", "model")
.with_timeouts(HttpTimeouts::new(Duration::from_secs(30), Duration::from_secs(300)));Sourcepub fn with_retry_config(self, retry: RetryConfig) -> Self
pub fn with_retry_config(self, retry: RetryConfig) -> Self
Sets the underlying model client’s retry policy.
Trait Implementations§
Source§impl Clone for OpenCodeConfig
impl Clone for OpenCodeConfig
Auto Trait Implementations§
impl Forget for OpenCodeConfig
impl Freeze for OpenCodeConfig
impl Move for OpenCodeConfig
impl RefUnwindSafe for OpenCodeConfig
impl Send for OpenCodeConfigwhere
RawVecInner: Send,
impl Sync for OpenCodeConfigwhere
RawVecInner: Sync,
impl Unpin for OpenCodeConfig
impl UnsafeUnpin for OpenCodeConfig
impl UnwindSafe for OpenCodeConfigwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request