magi-code 0.96.2

Repository-aware CLI coding agent for terminal work
Documentation
mod anthropic;
mod claude_admission;
pub(crate) mod claude_inert;
mod claude_projection;
pub(crate) mod claude_subscription;
pub(crate) mod claude_usage;
mod codex_session;
pub(crate) use codex_session::CodexTurnContext;
pub(crate) mod codex_usage;
pub(crate) mod error;
mod factory;
mod openai;
mod openai_stream;
mod replay_trace;
mod request;
mod skill_projection;
mod sse;
mod stream;
mod transport;

pub use anthropic::AnthropicProvider;
pub(crate) use factory::{
    provider_from_selection_with_settings_for_workload,
    provider_from_selection_with_settings_for_workload_with_resolved_auth,
    supported_custom_provider,
};
pub(crate) use openai::{
    CODEX_MODEL_CATALOG_CLIENT_VERSION, codex_account_id_for, codex_sse_headers_with_routing_hint,
    normalize_codex_model,
};
pub use openai::{OpenAiCodexProvider, OpenAiCompatibleProvider, Provider};
pub use request::{
    ChatMessage, MessageRole, ProviderConversationItem, ProviderRequest, ProviderSelection,
    ProviderToolResult,
};
pub(crate) use request::{conversation_id_for_session, default_model_for_provider};
pub use stream::{ProviderEvent, ReasoningSummary, ToolCall, Usage};
pub(crate) use stream::{StreamParser, UsageObservation, UsagePresence};
pub use transport::{HttpRequest, HttpResponseMetadata, HttpTransport, ReqwestHttpTransport};

pub const OPENAI_CODEX_PROVIDER: &str = "openai-codex";
pub const ANTHROPIC_PROVIDER: &str = "anthropic";
pub const CLAUDE_SUBSCRIPTION_PROVIDER: &str = "claude-subscription";

/// Claude CLI prompt ceiling, independent of the selected model's context window.
pub(crate) const CLAUDE_SUBSCRIPTION_MAX_PROMPT_TOKENS: usize = 202_000;

/// Providers whose usage follows Anthropic semantics: `input_tokens` excludes cache reads/writes.
pub(crate) fn reports_anthropic_usage(provider_id: &str) -> bool {
    matches!(
        provider_id,
        ANTHROPIC_PROVIDER | CLAUDE_SUBSCRIPTION_PROVIDER
    )
}
pub const DEFAULT_CODEX_MODEL: &str = "gpt-5.5";
pub const DEFAULT_ANTHROPIC_MODEL: &str = "claude-sonnet-4-5-20250929";
pub const CODEX_RESPONSES_URL: &str = "https://chatgpt.com/backend-api/codex/responses";
pub const CODEX_MODELS_URL: &str = "https://chatgpt.com/backend-api/codex/models";

#[cfg(test)]
pub(crate) use openai::{
    build_chat_completion_tools_json, chat_completion_tools_json,
    openai_compatible_chat_completions_body,
};