Skip to main content

OpenCodeProviderType

Enum OpenCodeProviderType 

Source
pub enum OpenCodeProviderType {
Show 45 variants OpenCodeZen, ZaiDirect, ZaiCodingPlan, Moonshot, MiniMax, Anthropic, OpenAI, Google, GoogleVertex, AmazonBedrock, AzureOpenAI, GithubCopilot, Groq, Together, Fireworks, Cerebras, SambaNova, DeepInfra, OpenRouter, Cloudflare, Vercel, Helicone, ZenMux, DeepSeek, Xai, Mistral, Cohere, Perplexity, AI21, VeniceAI, HuggingFace, Replicate, Baseten, Cortecs, Scaleway, OVHcloud, IONet, Nebius, SapAICore, AzureCognitiveServices, Ollama, LMStudio, OllamaCloud, LlamaCpp, Custom,
}
Expand description

OpenCode provider type extracted from model flag.

OpenCode supports 75+ providers through the AI SDK and Models.dev. This enum explicitly lists all major provider categories for clear identification and provider-specific authentication guidance.

Variants§

§

OpenCodeZen

OpenCode Zen - gateway for multiple providers via unified API.

§

ZaiDirect

Z.AI Direct - direct access to Z.AI/ZhipuAI models.

§

ZaiCodingPlan

Z.AI Coding Plan - Z.AI coding subscription plan.

§

Moonshot

Moonshot AI / Kimi.

§

MiniMax

MiniMax AI.

§

Anthropic

Anthropic (Claude models).

§

OpenAI

OpenAI (GPT models).

§

Google

Google AI (Gemini models).

§

GoogleVertex

Google Vertex AI (enterprise Gemini).

§

AmazonBedrock

Amazon Bedrock.

§

AzureOpenAI

Azure OpenAI Service.

§

GithubCopilot

GitHub Copilot (Chat).

§

Groq

Groq (fast inference).

§

Together

Together AI.

§

Fireworks

Fireworks AI.

§

Cerebras

Cerebras.

§

SambaNova

SambaNova.

§

DeepInfra

DeepInfra.

§

OpenRouter

OpenRouter (model aggregator).

§

Cloudflare

Cloudflare Workers AI.

§

Vercel

Vercel AI Gateway.

§

Helicone

Helicone (observability + gateway).

§

ZenMux

ZenMux (AI gateway).

§

DeepSeek

DeepSeek (coding-focused).

§

Xai

xAI (Grok).

§

Mistral

Mistral AI.

§

Cohere

Cohere.

§

Perplexity

Perplexity (search-augmented).

§

AI21

AI21 Labs.

§

VeniceAI

Venice AI.

§

HuggingFace

HuggingFace Inference.

§

Replicate

Replicate.

§

Baseten

Baseten.

§

Cortecs

Cortecs.

§

Scaleway

Scaleway.

§

OVHcloud

OVHcloud.

§

IONet

IO.NET.

§

Nebius

Nebius.

§

SapAICore

SAP AI Core.

§

AzureCognitiveServices

Azure Cognitive Services.

§

Ollama

Ollama (local).

§

LMStudio

LM Studio (local).

§

OllamaCloud

Ollama Cloud (remote Ollama).

§

LlamaCpp

llama.cpp (local).

§

Custom

Custom/unknown provider (OpenCode may still support it).

Implementations§

Source§

impl OpenCodeProviderType

Source

pub fn from_model_flag(model_flag: &str) -> Self

Detect provider type from a model flag string.

Source§

impl OpenCodeProviderType

Source

pub const fn name(self) -> &'static str

Get the display name for this provider.

Source

pub const fn auth_command(self) -> &'static str

Get authentication command/instructions for this provider.

Source

pub const fn prefix(self) -> &'static str

Get the model prefix for this provider.

Source

pub const fn requires_cloud_config(self) -> bool

Check if this provider requires special cloud configuration.

Source

pub const fn is_local(self) -> bool

Check if this is a local provider (no API key needed).

Source§

impl OpenCodeProviderType

Source

pub const fn example_models(self) -> &'static [&'static str]

Get example models for this provider type.

Trait Implementations§

Source§

impl Clone for OpenCodeProviderType

Source§

fn clone(&self) -> OpenCodeProviderType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpenCodeProviderType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for OpenCodeProviderType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for OpenCodeProviderType

Source§

fn eq(&self, other: &OpenCodeProviderType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for OpenCodeProviderType

Source§

impl Eq for OpenCodeProviderType

Source§

impl StructuralPartialEq for OpenCodeProviderType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.