confamnode 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,8 @@ dist/
20
20
  .pytest_cache/
21
21
 
22
22
  # Test files
23
- test_chat.py
24
- test_stream.py
23
+ chat_test.py
24
+ stream_test.py
25
25
  exchange_rate_calc.py
26
26
 
27
27
  # Other files
@@ -0,0 +1,406 @@
1
+ Metadata-Version: 2.4
2
+ Name: confamnode
3
+ Version: 0.1.2
4
+ Summary: The Nigerian AI inference gateway
5
+ Project-URL: Repository, https://github.com/confamnodeai/confamnode
6
+ Project-URL: Bug Tracker, https://github.com/confamnodeai/confamnode/issues
7
+ Author-email: JoTeq the First <hello@confamnode.com>
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: ai,confamnode,inference,joteq,llm,nigeria
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: litellm>=1.87.1
22
+ Requires-Dist: python-dotenv>=1.2.2
23
+ Description-Content-Type: text/markdown
24
+
25
+ # ConfamNode
26
+
27
+ The Nigerian AI inference gateway. Access frontier AI models.
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ ### Using pip
34
+ ```bash
35
+ pip install confamnode
36
+ ```
37
+
38
+ ### Using uv
39
+ ```bash
40
+ uv add confamnode
41
+ ```
42
+
43
+ ### Using virtualenv
44
+ ```bash
45
+ # Create virtual environment
46
+ python -m venv venv
47
+
48
+ # Activate — Linux/Mac
49
+ source venv/bin/activate
50
+
51
+ # Activate — Windows
52
+ venv\Scripts\activate
53
+
54
+ # Install
55
+ pip install confamnode
56
+ ```
57
+
58
+ ### Using uv with virtual environment
59
+ ```bash
60
+ # Create project
61
+ uv init my-project
62
+ cd my-project
63
+
64
+ # Add confamnode
65
+ uv add confamnode
66
+
67
+ # Run your script
68
+ uv run python main.py
69
+ ```
70
+
71
+ ### Using conda
72
+ ```bash
73
+ # Create environment
74
+ conda create -n my-project python=3.10
75
+ conda activate my-project
76
+
77
+ # Install
78
+ pip install confamnode
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Quick Start
84
+
85
+ ```python
86
+ from confamnode import ConfamNode
87
+
88
+ client = ConfamNode(api_key="confam-sk-xxx")
89
+
90
+ ansa = client.gist(
91
+ model="confam-speed",
92
+ messages="How you dey?"
93
+ )
94
+
95
+ print(ansa.text)
96
+ print(f"Cost: ₦{ansa.cost.naira:.6f}")
97
+ print(f"Tokens: {ansa.usage.total_tokens}")
98
+ print(f"ID: {ansa.id}")
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Streaming
104
+
105
+ ```python
106
+ from confamnode import ConfamNode
107
+
108
+ client = ConfamNode(api_key="confam-sk-xxx")
109
+
110
+ stream = client.gist(
111
+ model="confam-speed",
112
+ messages="Wetin be the capital of 9ja?",
113
+ stream=True
114
+ )
115
+
116
+ # Print tokens as they arrive
117
+ for yarn in stream:
118
+ content = yarn.choices[0].delta.content
119
+ if content:
120
+ print(content, end="", flush=True)
121
+
122
+ # Get full Ansa after stream completes
123
+ ansa = stream.get_ansa()
124
+ print(f"\nModel: {ansa.model}")
125
+ print(f"Tokens: {ansa.usage.total_tokens}")
126
+ print(f"Cost: ₦{ansa.cost.naira:.6f}")
127
+ if ansa.cost.dollars:
128
+ print(f"${ansa.cost.dollars:.8f}")
129
+ print(f"ID: {ansa.id}")
130
+ ```
131
+
132
+ ---
133
+
134
+ ## The Ansa Response Object
135
+
136
+ Every `gist()` call returns an `Ansa` object:
137
+
138
+ ```python
139
+ ansa = client.gist(model="confam-speed", messages="How far?")
140
+
141
+ # Response
142
+ ansa.text # response text
143
+ ansa.model # model that served the request
144
+ ansa.reasoning # thinking trace (reasoning models only)
145
+ ansa.tools # tool calls (agent models only)
146
+ ansa.citations # citations (search models only)
147
+ ansa.finish_reason # why generation stopped
148
+
149
+ # Usage
150
+ ansa.usage.prompt_tokens # input tokens used
151
+ ansa.usage.completion_tokens # output tokens used
152
+ ansa.usage.total_tokens # total tokens used
153
+
154
+ # Cost — Naira first
155
+ ansa.cost.naira # total cost in Naira ← primary
156
+ ansa.cost.naira_input # input cost in Naira
157
+ ansa.cost.naira_output # output cost in Naira
158
+ ansa.cost.dollars # cost in USD (if available)
159
+
160
+ # Identity
161
+ ansa.is_local # True — runs on Nigerian hardware
162
+ ansa.is_ngn_data_residency # True — data never leaves Nigeria
163
+ ansa.id # unique request ID (confam-xxxx-xxxx)
164
+ ansa.raw # original LiteLLM response
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Models
170
+
171
+ ### Free Tier
172
+
173
+ | Model | Description | Price |
174
+ |---|---|---|
175
+ | `confam-lite` | Light text and general chat | Free |
176
+ | `confam-speed` | Fast, high quality responses | Free |
177
+ | `confam-reasoning` | Standard reasoning and analysis | Free |
178
+
179
+ ### Paid Tier
180
+
181
+ | Model | Description | Input ₦/1M | Output ₦/1M | Input ₦/1K | Output ₦/1K |
182
+ |---|---|---|---|---|---|
183
+ | `confam-intelligence` | General smart tasks, 1M context | ₦596 | ₦3,571 | ₦0.596 | ₦3.571 |
184
+ | `confam-deep-reasoning` | Complex thinking, multi-step analysis | ₦234 | ₦468 | ₦0.234 | ₦0.468 |
185
+ | `confam-code` | Coding assistance, 1M context | ₦234 | ₦468 | ₦0.234 | ₦0.468 |
186
+
187
+ ### Local Models — Nigeria Data Residency
188
+
189
+ | Model | Description | Input ₦/1M | Output ₦/1M | Input ₦/1K | Output ₦/1K |
190
+ |---|---|---|---|---|---|
191
+ | `confam-nano` | Qwen3.5 4B on Jetson Orin Nano | ₦500 | ₦1,500 | ₦0.500 | ₦1.500 |
192
+
193
+ Runs entirely on Nigerian hardware. Data never transmitted abroad.
194
+
195
+ Data never leaves Nigeria. Ideal for banks, fintechs, hospitals, law firms, and government agencies.
196
+
197
+ More models coming soon. Contact [hello@confamnode.com](mailto:hello@confamnode.com) for early access.
198
+
199
+ ---
200
+
201
+ ## Pricing
202
+
203
+ All prices are in Nigerian Naira (₦). No USD. No conversion needed.
204
+
205
+ | Tier | How it works |
206
+ |---|---|
207
+ | Free | Use immediately. No wallet needed. Shared capacity. |
208
+ | Paid | Contact us to get access. Pay in Naira. No subscription. No expiry. |
209
+
210
+ **Currently in private beta.**
211
+ To get API access: [hello@confamnode.com](mailto:hello@confamnode.com)
212
+
213
+ ---
214
+
215
+ ## Rate Limits
216
+
217
+ Rate limits vary by plan. Contact [hello@confamnode.com](mailto:hello@confamnode.com).
218
+
219
+ - **Free tier** — shared capacity with lower limits
220
+ - **Paid tier** — dedicated higher limits
221
+ - **confam-nano** — limited capacity, queue-based
222
+
223
+ ---
224
+
225
+ ## System Message
226
+
227
+ ConfamNode adds a default system message to every request giving the model a Nigerian identity and context. This is standard behaviour across all LLM providers and is counted in `prompt_tokens`.
228
+
229
+ ```python
230
+ # Use ConfamNode default identity (default)
231
+ ansa = client.gist(
232
+ model="confam-speed",
233
+ messages="Who are you?"
234
+ )
235
+ # "I am ConfamNode, Nigeria's AI inference gateway..."
236
+
237
+ # Override with your own system message
238
+ ansa = client.gist(
239
+ model="confam-speed",
240
+ messages="Who are you?",
241
+ system="You are a helpful customer service agent for Konga."
242
+ )
243
+
244
+ # Disable system message entirely
245
+ ansa = client.gist(
246
+ model="confam-speed",
247
+ messages="Who you be?",
248
+ system=None
249
+ )
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Reasoning Models
255
+
256
+ Enable extended thinking for complex problems:
257
+
258
+ ```python
259
+ ansa = client.gist(
260
+ model="confam-reasoning",
261
+ messages="One trader buy goods for ₦50,000 sell am for ₦75,000. After e pay ₦5,000 for transport and ₦3,000 for market, wetin be the real profit? Show how you calculate am.",
262
+ # Explicit reasoning control
263
+ allowed_openai_params=["reasoning_effort"],
264
+ rreasoning_effort={"effort": "low", "summary": "detailed"} # effort can be "low", "mid", "high", or "xhigh". summary can be "detailed", or "concise"
265
+ )
266
+
267
+ print(ansa.reasoning) # thinking trace
268
+ print(ansa.text) # final answer
269
+ ```
270
+
271
+ Also available on `confam-deep-reasoning` for more complex multi-step problems:
272
+
273
+ ```python
274
+ ansa = client.gist(
275
+ model="confam-deep-reasoning",
276
+ messages="Analyse the financial risk of a Nigerian fintech expanding to Ghana...",
277
+ # Explicit reasoning control
278
+ allowed_openai_params=["reasoning_effort"],
279
+ rreasoning_effort={"effort": "low", "summary": "detailed"} # effort can be "low", "mid", "high", or "xhigh". summary can be "detailed", or "concise"
280
+ )
281
+
282
+ print(ansa.reasoning) # full thinking trace
283
+ print(ansa.text) # final analysis
284
+ ```
285
+
286
+ ---
287
+
288
+ ## RAG (Retrieval-Augmented Generation)
289
+
290
+ ### Best models for RAG
291
+
292
+ | Model | Why | Context |
293
+ |---|---|---|
294
+ | `confam-intelligence` | General RAG, reliable, long context | 1M tokens |
295
+ | `confam-code` | Code search, documentation RAG | 1M tokens |
296
+ | `confam-deep-reasoning` | Complex RAG, multi-hop reasoning | 1M tokens |
297
+
298
+ ---
299
+
300
+ ## Data Residency
301
+
302
+ Nigerian businesses handling sensitive data can use local models that run entirely on Nigerian hardware — data is never transmitted abroad:
303
+
304
+ ```python
305
+ ansa = client.gist(
306
+ model="confam-nano",
307
+ messages="Analyse this sensitive document..."
308
+ )
309
+
310
+ print(ansa.is_local) # True — runs on Nigerian hardware
311
+ print(ansa.is_ngn_data_residency) # True — data never leaves Nigeria
312
+ print(ansa.text)
313
+ ```
314
+
315
+ **Ideal for:**
316
+ - Nigerian banks and fintechs
317
+ - Healthcare companies
318
+ - Law firms
319
+ - Government agencies
320
+ - Any business with strict data residency requirements
321
+
322
+ ---
323
+
324
+ ## Environment Variable
325
+
326
+ ```bash
327
+ export CONFAMNODE_API_KEY="confam-sk-xxx"
328
+ ```
329
+
330
+ ```python
331
+ # No need to pass api_key explicitly
332
+ client = ConfamNode()
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Custom Base URL
338
+
339
+ For enterprise clients running ConfamNode on private infrastructure:
340
+
341
+ ```python
342
+ client = ConfamNode(
343
+ api_key="confam-sk-xxx",
344
+ base_url="http://your-private-server:4000/v1"
345
+ )
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Error Handling
351
+
352
+ ```python
353
+ from confamnode import (
354
+ ConfamAuthError,
355
+ ConfamRateLimitError,
356
+ ConfamModelError,
357
+ ConfamNodeError
358
+ )
359
+
360
+ try:
361
+ ansa = client.gist(
362
+ model="confam-speed",
363
+ messages="How you dey?"
364
+ )
365
+ except ConfamAuthError:
366
+ print("Check your API key")
367
+ except ConfamRateLimitError:
368
+ print("You don reach your limit. Contact hello@confamnode.com")
369
+ except ConfamModelError:
370
+ print("Invalid model name")
371
+ except ConfamNodeError as e:
372
+ print(f"Something went wrong: {e}")
373
+ ```
374
+
375
+ ---
376
+
377
+ ## Private AI Deployment
378
+
379
+ Need Data-residential private AI on your own infrastructure?
380
+
381
+ JoTeq the First offers:
382
+ - On-premise deployment on Jetson devices and GPUs
383
+ - RTX 3090/4090 bare metal setup
384
+ - RAG pipelines and fine-tuning
385
+ - Dedicated hosted models
386
+ - SSH remote deployment
387
+
388
+ Contact: [hello@confamnode.com](mailto:hello@confamnode.com)
389
+
390
+ ---
391
+
392
+ ## Links
393
+
394
+ - PyPI: [pypi.org/project/confamnode](https://pypi.org/project/confamnode)
395
+ - GitHub: [github.com/confamnodeai/confamnode](https://github.com/confamnodeai/confamnode)
396
+ - General: [hello@confamnode.com](mailto:hello@confamnode.com)
397
+ - Support: [support@confamnode.com](mailto:support@confamnode.com)
398
+ - Billing: [billing@confamnode.com](mailto:billing@confamnode.com)
399
+
400
+ ---
401
+
402
+ ## License
403
+
404
+ Apache 2.0
405
+
406
+ ---